Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User amipatel's Avatar
    Join Date
    Jun 2008
    Posts
    87
    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 Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    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 vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,840
    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 amipatel's Avatar
    Join Date
    Jun 2008
    Posts
    87
    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 Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    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 wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved