×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    87

    create single number type list box at runtime

    Hi

    i try to create listbox on empty container at runtime.
    but nothing is displays.

    mu code is
    Code:
    void CList::InitializeControlsL()
    	{
    	// listbox instance
    	CEikColumnListBox* list = new (ELeave) CAknSingleNumberStyleListBox;
    	// construct listbox
    	list->ConstructL(this);
    	// set container control
    	list->SetContainerWindowL(*this);
    	// add scrollbars to listbox
    	list->CreateScrollBarFrameL(ETrue);
    	list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn,CEikScrollBarFrame::EAuto );
    	CDesCArray *itemList = new (ELeave) CDesCArrayFlat(1);
    	TBuf<32> item;
    	_LIT(KListItemFormat, "1/tfirst/t");
    	item.Format(KListItemFormat);
    	itemList->AppendL(item); 
    	list->Model()->SetItemTextArray(itemList);
    	list->Model()->SetOwnershipType(ELbmOwnsItemArray);
    	list->HandleItemAdditionL();
    	}
    is there anything which i missed out?
    Thank you
    Ami Patel

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: create single number type list box at runtime

    Your CList class needs to have a CreateWindow() call somewhere so the compound container control has a real window to draw on.
    Do not use forward slashes in place of backslashes, backslash has a special meaning in C/C++.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  3. #3
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,988

    Re: create single number type list box at runtime

    try somthing lik this::

    iListBox=new (ELeave)CAknDoubleStyleListBox ;//CAknSingleNumberStyleListBox();
    iListBox->SetContainerWindowL(*this);
    // iCallProfileListBox->ConstructL(this,EAknListBoxMultiselectionList);
    TResourceReader reader;

    CEikonEnv::Static()->CreateResourceReaderLC(reader,R_MARKABLELIST_LISTBOX);
    iListBox->ConstructFromResourceL(reader);
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);

    CleanupStack::PopAndDestroy(); // reader
    // iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconList);

    listBoxItems=static_cast<CDesC16Array*>(iListBox->Model()->ItemTextArray());

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    87

    Re: create single number type list box at runtime

    Quote Originally Posted by Paul.Todd View Post
    Your CList class needs to have a CreateWindow() call somewhere so the compound container control has a real window to draw on.
    Do not use forward slashes in place of backslashes, backslash has a special meaning in C/C++.
    Hi Paul

    I have a CreateWindow() method called before InitializeControlsL(). still its not working.

    Thanks
    Ami Patel

  5. #5
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: create single number type list box at runtime

    Most noob errors are here:
    Did you call ActivateL in your code.
    Did you call SetRect in your container
    Did you correctly implement CountComponentControls and ComponentControl?
    Did you correctly implement SizeChanged?
    Did you call SetCurrentItem?

    I strongly recommend you start with a project that works and then work out what is different in yours.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: create single number type list box at runtime

    There are listbox examples everywhere, FN, DiBo, Wiki.
    My personal favourite is mine in http://discussion.forum.nokia.com/fo...ad.php?t=92554, but there are numerous others, have you even considered searching?

Similar Threads

  1. how to updated the list box on dialog box before it is displaying it.
    By manjunaths in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-03-20, 10:37
  2. column list box not shown correctly in landscape mode.
    By praveena_R in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-12-14, 10:14
  3. Replies: 1
    Last Post: 2007-11-21, 10:42
  4. WML & WMLSCript problem ????
    By gemini_shooter in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-14, 06:02
  5. How to create 2 column list box?
    By Marw_Work in forum Symbian User Interface
    Replies: 2
    Last Post: 2002-08-21, 08:13

Posting Permissions

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