"Constructing Listbox from Resource"- problem
| Tue, 2007-02-06 11:14 | |
|
Hi,
I hav been trying the listbox construction from quite some time but no use. i dnt get any comple-time or runtime error but am unable to c the listbox. hav seen SDK help,all forum helps n use the same code but no help. my container class' code is as follows: #include <aknlists.h> #include <barsread.h> #include <avkon.hrh> void Csh_listAppView::ConstructL(const TRect& aRect) { // Create a window for this application view CreateWindowL(); // Set the windows size SetRect(aRect); list = new (ELeave) CAknSingleStyleListBox; //list->ConstructL(this); list->SetContainerWindowL(*this); TResourceReader rr; iCoeEnv->CreateResourceReaderLC(rr,R_SS_LIST_TRY); list->ConstructFromResourceL(rr); CleanupStack::PopAndDestroy(); SizeChanged(); list->ActivateL(); DrawNow(); // Activate the window, which makes it ready to be drawn ActivateL(); MakeVisible(ETrue); } My resorce file: RESOURCE LISTBOX R_SS_LIST_TRY { array_id = R_SS_LIST_TRY_ITEMS; flags = EAknListBoxSelectionList; } RESOURCE ARRAY R_SS_LIST_TRY_ITEMS { items = { LBUF { txt = "\titem1\t0\t1"; }, LBUF { txt = "\titem2\t0\t1"; }, LBUF { txt = "\titem3\t0\t1"; } }; } Do help me if anyone finds any solution |
|






Forum posts: 78
Forum posts: 5
list->SetRect(aRect);
do v need to specify certain size as well?
Forum posts: 278
eg:
void Csh_listAppView::SizeChanged()
{
list->SetExtent (TPoint(0,0), list->MinimumSize());
}
Forum posts: 5
but now i m getting run-time error..."App-Closed ".
hav been strugling over frm quite sum time but no luck
Forum posts: 278
iListBox = new( ELeave ) CAknSingleStyleListBox();
iListBox->ConstructL( this, EAknListBoxSelectionList);
iListBox->CreateScrollBarFrameL(ETrue);
//add the items to the list
iAvkonAppUi->AddToStackL(iListBox);
iListBox->ActivateL();
iListBox->DrawNow();
SetRect(aRect);
ActivateL();
//no need to call SizeChanged
Forum posts: 5
" iAvkonAppUi->AddToStackL(iListBox);" ?