The Motorola Development Community


Go Back   MotorolaFans.com Forums > Developments > Development
Notices

Development Hacking, development, scripts etc

Reply

Moderator

eakrin's Avatar

Join Date: Jul 2005
Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand

Send a message via ICQ to eakrin Send a message via MSN to eakrin Send a message via Yahoo to eakrin Send a message via Skype™ to eakrin
Quote  
#1
03-07-2008
Default [ZPushButton] EZX programming for dummy by dummy E6, A1200

for A1200, E6

Because of EZX SDK is not 100% complete. so everybody should face problem when try to create widget on screen. I start this thread for sharing experience about create EZX Widgets. This can lead to a nearly complete EZX SDK and Document them.

First I create a demo for ZPushButton. ZPushButton is derive from QToolButton. and I found 3 of them in the header file.

Quote:
ZPushButton in ZPushButton.h
UTIL_PushButton in ezxutilpushbutton.h
UTIL_PushButton in UTIL_PushButton.h
I can create only ZPushButton on screen. both UTIL_PushButton cause a segmentation fault error.

when create ZPushButton with no Resource ID. ZPushButton dispaly itself a CST Button. Its can be resize to any width.

Code:
    ZPushButton *normal = new ZPushButton( this, 0 );
But when create ZPushButton
with resource ID

Code:
    ZPushButton *rew = new ZPushButton( "MessCe_Rew", this );
ZPushButton will load all set of resource id (normal, action, disable, ...) from iconres.ezx or skin file and display itself. but ZPushButton does not resize resource id or resize itself to fit a resource. It need a layout manager do it or by coding.

Here is my button demo.
Code:
// HelloButton : HelloButton.h
// EZX demo for Button Widget.
// by eakrin @ gmail.com
// 2008 Mar 07

#ifndef __HELLOBUTTON__
#define __HELLOBUTTON__

#include <ZMainWidget.h>

class HelloButton : public ZMainWidget
{
    Q_OBJECT
    public:
        HelloButton();
        ~HelloButton();

    public slots:
        void showDialog();
};

#endif // __HELLOBUTTON
Code:
// HelloButton : HelloButton.cpp
// EZX demo for Button Widget.
// by eakrin @ gmail.com
// 2008 Mar 07

#include "HelloButton.h"

#include <ZApplication.h>
#include <ZMainwidget.h>
#include <ZPushButton.h>
#include <ZMessageBox.h>

#include <ezxutilcst.h>

#include <qlayout.h>
#include <qlabel.h>
#include <qframe.h>

HelloButton::HelloButton ()
    : ZMainWidget( false, NULL, "ButtonTester", 0 )
{
    // Create CST widget.
    UTIL_CST *cst = new UTIL_CST( this, "Test Buttons" );
    setCSTWidget( cst );
    cst->show();

    // Create CST buttons.
    ZPushButton *btn;
    btn = cst->getRightBtn();
    connect( btn, SLOT( clicked() ), qApp, SLOT( slotQuickQuit() ) );

    // Create content Layout.
    QVBoxLayout *contentLayout = new QVBoxLayout ( this->getContentWidget( true ) );

    // Create Testing Resource Button from iconres.ezx. 
    QHBoxLayout *layout1 = new QHBoxLayout;

    QLabel *label1 = new QLabel( "Test ZPushButton :", this, "label1" );
    ZPushButton *btn1 = new ZPushButton( "InSet_Picker_Date", this);
    //btn1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    //btn1->resize( 100, 28 );
    connect( btn1, SIGNAL( clicked() ), this, SLOT( showDialog() ) );

    layout1->addWidget( label1 );
    layout1->addStretch();
    layout1->addWidget( btn1 );
    contentLayout->addLayout( layout1 );

    // Create Player buttons.
    QHBoxLayout *player = new QHBoxLayout;

    ZPushButton *rew = new ZPushButton( "MessCe_Rew", this );
    ZPushButton *play = new ZPushButton( "MessCe_Msg_Play", this );
    ZPushButton *pause = new ZPushButton( "MessCe_Msg_Pause", this );
    ZPushButton *fwd = new ZPushButton( "MessCe_Fast_Fwd", this );
// Toggle Button Does not work.
//    play->setToggleButton( TRUE );

    player->addWidget( rew );
    player->addStretch();
    player->addWidget( play );
    player->addStretch();
    player->addWidget( pause );
    player->addStretch();
    player->addWidget( fwd );
    contentLayout->addLayout( player );

    connect( rew, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
    connect( play, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
    connect( pause, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
    connect( fwd, SIGNAL( clicked() ), this, SLOT( showDialog() ) );

    // Create Normal button style -> only CST Button can stretch resouce ID button cannot.
    ZPushButton *normal = new ZPushButton( this, 0 );
    normal->setText( "No resource" );
    normal->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
    contentLayout->addWidget( normal );
    normal->setGeometry( 120, 0, 110, 35 );

    connect( normal, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
}

HelloButton::~HelloButton()
{

}

void HelloButton::showDialog()
{
    ZMessageBox::information( this, NULL, "Test Push Button", "Ok" );
}
Code:
// HelloButton : main.cpp
// EZX demo for Button Widget.
// by eakrin @ gmail.com
// 2008 Mar 07

#include <ZApplication.h>
#include "HelloButton.h"

int main( int argc, char** argv )
{
    ZApplication app( argc, argv );
    HelloButton *mw = new HelloButton();

    app.showMainWidget(mw);
    return app.exec();
}
PS. Cannot create Toggle button with ZPushButton. because setToggleButton and setToggleType are protected and does not derive from QButton to ZPushButton.
Attached Images
 
__________________
Visit my Blog here.http://my.opera.com/eakrin

Last edited by eakrin; 03-14-2008 at 05:49 AM. Reason: specific phone models, Add screenshot.
Reply With Quote


User Information
Current Phone: E6 A1200 A780
Firmware: Lamborghini 09P
Location: Thailand

eakrin is offlineReport Post
The Following 4 Users Say Thank You to eakrin For This Useful Post:
digitalD (03-10-2008), latino18hvm (09-20-2008), quakeboy (04-12-2008), ustrucx (03-07-2008)
MotoFans JUNR

Join Date: Oct 2007
Posts: 88
Thanks: 1
Thanked 4 Times in 4 Posts
Quote  
#2
03-07-2008
Default

E680?
E6?
A1200?
Reply With Quote


User Information
Current Phone: e6
ljty is offlineReport Post
MotoFans NWBE

Join Date: Nov 2007
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
Location: Thailand

Quote  
#3
03-08-2008
Default

you will get more than what you share.
Reply With Quote


User Information
Current Phone: Motorola ROKR E6
Location: Thailand

neonicus is offlineReport Post
Moto Fans SENR

Join Date: Sep 2005
Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia

Quote  
#4
03-08-2008
Default

@eakrin
But for me, UTIL_PushButton more stable I think. ZPushButton sometimes raised seg. fault both on E680i and A1200. Both widget have no destructor, you have to remove virtual ~ZPushButton and virtual ~UTIL_PushButton from the header file.

You can test a header file and access protected members using subclassing method. Taken from my modification on FBReader:
Code:
class MySpinBox : public QSpinBox
{
public:
  MySpinBox(int min, int max, int step, QWidget* parent) : QSpinBox(min, max, step, parent) {}

  MySpinBox::~MySpinBox() {}

  // access protected QLineEdit
  QLineEdit *lineEdit() const {
    return editor();
  }
};
Reply With Quote


User Information
Current Phone: Motorola E680i and A1200
Location: Jakarta, Indonesia

blackhawk is offlineReport Post
Moderator

eakrin's Avatar

Join Date: Jul 2005
Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand

Send a message via ICQ to eakrin Send a message via MSN to eakrin Send a message via Yahoo to eakrin Send a message via Skype™ to eakrin
Quote  
#5
03-09-2008
Default

@blackhawk
thank I 'll try subclass to test protected member. Now I understand what is subclassing. LOL.

about ZPushButton and UTIL_PushButton. I found it's destructor in library dump file. both have destructor. I try many of UTIL_*. all of them cause segmentation fault but Q* doesn't . what UTIL_*.h that you use?

I try to compare UTIL_ListBox.h from library dump file. and remove some function. but UTIL_ListBox still cause segmentation fault. only QListBox I can used.
__________________
Visit my Blog here.http://my.opera.com/eakrin
Reply With Quote


User Information
Current Phone: E6 A1200 A780
Firmware: Lamborghini 09P
Location: Thailand

eakrin is offlineReport Post
Moto Fans SENR

Join Date: Sep 2005
Posts: 1,091
Thanks: 0
Thanked 132 Times in 67 Posts
Location: Jakarta, Indonesia

Quote  
#6
03-09-2008
Default

@eakrin
You can compare your headers with my mine:
http://keaglez.e2mod.com/upload/sdk/...80i-SDK.tar.gz
It's modified version of samr7's SDK + foxe6 update.
Reply With Quote


User Information
Current Phone: Motorola E680i and A1200
Location: Jakarta, Indonesia

blackhawk is offlineReport Post
MotoFans MODR

asiong's Avatar

Join Date: Oct 2006
Posts: 132
Thanks: 14
Thanked 86 Times in 16 Posts
Quote  
#7
03-09-2008
Default

can you post a screenshot of this app.tnx
Reply With Quote


User Information
Current Phone: motorola rokr e6
asiong is online nowReport Post
Moderator

eakrin's Avatar

Join Date: Jul 2005
Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand

Send a message via ICQ to eakrin Send a message via MSN to eakrin Send a message via Yahoo to eakrin Send a message via Skype™ to eakrin
Quote  
#8
03-10-2008
Default

@asiong
I updated a HelloButton's screenshot.

@blackhawk.
I compare ZApplication class between yours mod from sam, and Fox (in my distributed SDK), and ezxappbase's dump file.

1. your's mod header are base on A780/E680i have less compatible to a lib-dump-file than FoxE6. FoxE6's SDK mod from an old leak header files from motorola A760 or 768 (year 2003-2004).

2. sam 's SDK does not well categorist ZObjects and UTIL_Objects. some class are defined in the other header file.

This is a huge project. need more testing. I thing we both test another sdk and file what different and what each other like to use.
__________________
Visit my Blog here.http://my.opera.com/eakrin
Reply With Quote


User Information
Current Phone: E6 A1200 A780
Firmware: Lamborghini 09P
Location: Thailand

eakrin is offlineReport Post
MotoFans NWBE

Join Date: Nov 2007
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
Location: Thailand

Quote  
#9
03-12-2008
Default

Quote:
ZPushButton *btn1 = new ZPushButton( "InSet_Picker_Date", this);
If I want to use time box ,can I change it to
Quote:
ZPushButton *btn1 = new ZPushButton( "InSet_Picker_Time", this);
?
Reply With Quote


User Information
Current Phone: Motorola ROKR E6
Location: Thailand

neonicus is offlineReport Post
Moderator

eakrin's Avatar

Join Date: Jul 2005
Posts: 833
Thanks: 25
Thanked 219 Times in 80 Posts
Location: Thailand

Send a message via ICQ to eakrin Send a message via MSN to eakrin Send a message via Yahoo to eakrin Send a message via Skype™ to eakrin
Quote  
#10
03-13-2008
Default

@neonicus
InSet_Picker_Date is a name for icon without .g suffix. you need to extract main iconres.ezx in /usr/data_resource/icon to see it's name. you can call any icon.

But ZPushButton does not resize it self to fit image. you need to addStretch() in layout before or after ZPushButton.
in HelloButton example. I addStretch() between all media key. Try to remove it and tap between button to prove my assumption.

and I try to create ZPushButton from *.skn component. but It doesn't worked. It's always be a CST Button.
__________________
Visit my Blog here.http://my.opera.com/eakrin
Reply With Quote


User Information
Current Phone: E6 A1200 A780
Firmware: Lamborghini 09P
Location: Thailand

eakrin is offlineReport Post
Reply

Tags
dummy, ezx, programming

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 PM. Search Engine Friendly URLs by vBSEO 3.2.0 Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. VBulletin Skin by ForumMonkeys.