Read-only archive of the All About Symbian forum (2001–2013) · About this archive

Please Help Me !!! :-(

0 replies · 959 views · Started 05 August 2004

Hi all
(Series 60 related question)
Please help me , because I tried many times to create a List Box in the Series 60 with no success.
I think that this is the best code I used so far ,
When I call the CreateListBox() method nothing happens and the view on the emulator stays the same ...
Here is some of the code including the AppView and AppUi headers (just in case ...)

please take a look at the code and advise me what to do because I'm so S T U C K !!!!

Thanks in Advance , TE

//  **** CPP ****
void CMyAppAppView::CreateListBox()
{
TInt aResourceId;
aResourceId = R_AKNTALIST_SINGLE_1;
CAknSingleStyleListBox* listBox = new(ELeave)CAknSingleStyleListBox();
listBox->SetContainerWindowL(*this);//parent
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, aResourceId);
observer = new (ELeave) CListBoxObserver;
listBox->SetObserver((MCoeControlObserver *)observer);
listBox->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy(); // resource

//I tried to add these lines to the method - they didnt change a thing ...
listBox->CreateScrollBarFrameL(ETrue);
listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
TPoint aPosition(10,10);
listBox->SetExtent(aPosition,listBox->MinimumSize());
SizeChanged();
listBox->ActivateL();
DrawNow();
}

// **** RSS ****
RESOURCE LISTBOX r_akntalist_single_1
{
array_id = r_akntalist_item_single1;
flags = EAknListBoxSelectionList;
}

RESOURCE ARRAY r_akntalist_item_single1
{
items =
{
LBUF { txt = "Item1"; },
LBUF { txt = "Item2"; },
LBUF { txt = "Item3"; }
};
}

// **** HEADERS ****
class CListBoxObserver: public MEikListBoxObserver
{
public:
void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
};

class CMyAppAppView: public CCoeControl
{
public:
static CMyAppAppView* NewL(const TRect& aRect);
static CMyAppAppView* NewLC(const TRect& aRect);
CMyAppAppView();
void CreateListBox();
void ConstructL(const TRect& aRect);
void Draw(const TRect& aRect) const;
CMyAppAppUi* iAppUi;
CListBoxObserver* observer;
//...
};

class CMyAppAppUi: public CAknAppUi
{
public:
~CMyAppAppUi();
void ConstructL();
void HandleCommandL(TInt aCommandId);
CMyAppController* iController;
CMyAppAppView* iAppView;
// ....

};