Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2006

    custom control problem


    I am making an application in which I want selection list in each dialog page.

    In rss file:

    RESOURCE FORM r_music_form
    items =
    type = KmyList;
    id = ESinglePageDlgC1Id;
    control = MYLISTBOX
    { flags=EAknListBoxSelectionList|EAknListBoxLoopScrolling;
    array_id = r_list_box_array;

    In hrh file:
    enum {KmyList = KAknCtLastControlId };

    now as i will have to use custom control
    In .h file:

    class Clistcustom : public CEikDialog
    SEikControlInfo CreateCustomControlL(TInt aControlType);

    In .cpp file:

    SEikControlInfo Clistcustom::CreateCustomControlL(TInt aControlType)
    if(aControlType == KmyList )
    SEikControlInfo sinfo;
    sinfo.iControl = new (ELeave) Csetlist();
    return sinfo;
    return CEikDialog::CreateCustomControlL(aControlType);

    in setlist.cpp file:

    void Csetlist::ConstructL(CCoeControl& aParent)
    CEikTextListBox* list = new (ELeave) CAknSingleStyleListBox();
    TResourceReader rr;
    iEikonEnv->CreateResourceReaderLC(rr, R_DEMO_LISTBOX);

    // load and construct the resource
    CleanupStack::PopAndDestroy(); // rr

    and one more thing...in view.cpp:

    void ClabelAppView::HandleCommandL( TInt aCommand )
    switch ( aCommand )
    case ElabelCmdLaunchPhOps:
    iContainer->DisplayFormL( R_LABEL_NAVIPANE_DIALOG,

    What I don't understand is:

    1] what should I write in my code so that when dialog is running and new user defined type comes, compiler will call CreateCustomControlL(KmyList)
    becoz i havn't define anything regarding that!

    2] In symbian site there is an example of BlinkText(Symbian_OS_Creating_Custom_Controls_v1_0_en.pdf) but in that also there is no clearification regarding that.

    3]I m really not much clear with the concept of custom control so it becomes more confusing!

    plz help me regarding this becoz I m stuck in same problem since last 10 days:-(



  2. #2
    Registered User
    Join Date
    Mar 2003

    Re: custom control problem


    to define your own custom control, you have to do little bit more:
    * create a resource structure, which describes your control.
    for example:
    WORD flags;
    WORD array_id;

    * you have to overload void CCoeControl::ConstructFromResourceL(TResourceReader &aReader) and implement the 2nd phase of construction from resource.

    It means, when you create the control in Clistcustom::CreateCustomControlL(), the dialog will call Csetlist::ConstructFromResourceL() with initalized resource reader. Then you have to read all items you specified in the resource header file (ie. where MYLISTBOX is defined).

    If you want to pass the resource reader directly to the CAknSingleStyleListBox, be sure, that the structure is the same as LISTBOX structure, it means

    BYTE version; // version number
    WORD flags;
    WORD height; // in items
    WORD width; // in chars
    LLINK array_id; // points to items in ARRAY structure

    or at least it is part of your resource structure, so the CAknSingleStyleListBox can safely read its data. In this case,naturally, you should not read from the resource reader those items, becasue CAknSingleStyleListBox will do it for you.


  3. #3
    Registered User
    Join Date
    Apr 2006

    Re: custom control problem

    1. do not use form resource since form does not know how to layout your custom control. forms work fine with edwins, popup fields, but thats all. use simple array of lines instead of form with only one dlg_item in each array for each page.
    2. void Csetlist::ConstructL(CCoeControl& aParent) will not be called anymore when dialog framework is in use(custom control creation is invoked by dialog framework implementation). ConstructFromResource plays this role.
    3. you have to create child windows of your dialog's window(your custom controls have to be window-owning controls).

    1. createcustomcontrol is integral part of dialog framework. it allows you to include your custom controls inside dialogs/forms.
    2. combine this doc with "Symbian OS guide » Application framework » Using UI Control Framework (CONE) » Controls", "Symbian OS guide » Application framework » Using UI Control Framework (CONE) » How to Write Controls" and read it carefully.
    3. you need more time to understand some conceptions.

Similar Threads

  1. Nokia 6600 custom item problem
    By saqib_ch in forum Mobile Java General
    Replies: 0
    Last Post: 2006-06-13, 08:33
  2. Control Pane problem
    By sriramadasu in forum Symbian
    Replies: 1
    Last Post: 2006-06-06, 15:28
  3. problem in custom control.....
    By platinnum in forum Symbian
    Replies: 0
    Last Post: 2005-05-06, 07:29
  4. custom font problem
    By allyfeng in forum Symbian
    Replies: 8
    Last Post: 2005-05-03, 15:08
  5. Custom control in Series 60 form
    By jandrhub in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-03-09, 12:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts