Join Today
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
Like Tree4Likes

Thread: EZX programming for dummy by dummy

  1. #1

    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.

    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 Thumbnails Attached Thumbnails EZX programming for dummy by dummy-hellobutton_screenshot1.png  
    Last edited by eakrin; 03-14-2008 at 04:49 AM. Reason: specific phone models, Add screenshot.
    Visit my Blog here.http://my.opera.com/eakrin

  2. #2

    Default

    E680?
    E6?
    A1200?

  3. #3
    Join Date
    Nov 2007
    Location
    Thailand
    Posts
    16

    Default

    you will get more than what you share.

  4. #4
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    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();
      }
    };

  5. #5

    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

  6. #6
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    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.

  7. #7

    Default

    can you post a screenshot of this app.tnx

  8. #8

    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

  9. #9
    Join Date
    Nov 2007
    Location
    Thailand
    Posts
    16

    Default

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

  10. #10

    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 to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. EZX Crosstool and SDK for Motorola EZX phones
    By eakrin in forum Development
    Replies: 108
    Last Post: 11-10-2009, 11:13 AM
  2. [Req] EZX Programming Ebook
    By *~Nimsrules~* in forum Moto eBooks
    Replies: 2
    Last Post: 04-21-2009, 11:10 AM
  3. Replies: 15
    Last Post: 11-07-2008, 01:44 PM
  4. NEED HELP (DUMMY)
    By ROKR in forum E6 General Chat
    Replies: 3
    Last Post: 07-14-2007, 06:43 AM
  5. PLEASE PLEASE, HELP A DUMMY
    By luke1719 in forum E680i General Chat
    Replies: 4
    Last Post: 05-11-2006, 07:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1