Hi,
When creating the project, I chose the "GUI Application with UI Designer" and "An empty container", the name for empty container is "CTestAppContainer"
Now I want dynamically adding "CEikTextListBox" into that "CTestAppContainer", but don't know how to do it, please help to give me a guide or some examples.
Below code is for testing, but don't work,
The iTestAppContainer still shows nothing after executed the code.
Please notice that "iTestAppContainer" is defined in the CTestAppContainerViewCode:/** * Handle the selected event. * @param aCommand the command id invoked * @return ETrue if the command was handled, EFalse if not */ TBool CTestAppContainerView::HandleTestMenuItemSelectedL( TInt aCommand ) { // Create CEikTextListBox instance, list CEikTextListBox* list = new (ELeave) CAknSinglePopupMenuStyleListBox; // Initialize listbox. list->ConstructL(iTestAppContainer, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); MDesCArray* textArray = list->Model()->ItemTextArray(); CDesCArray* itemList = static_cast<CDesCArray*> (textArray); // Set listitems. list->Model()->SetOwnershipType(ELbmOwnsItemArray); for (TInt i = 0; i < 5; i++) { itemList->AppendL(_L("123456")); list->HandleItemAdditionL(); iTestAppContainer->DrawNow(); } iTestAppContainer->DrawNow(); return ETrue; }
Code:private: // [[[ begin generated region: do not modify [Generated Instance Variables] CTestAppContainer* iTestAppContainer; // ]]] end generated region [Generated Instance Variables]




