ListBox: Part VII
ListBox resource is described using LISTBOX structure (defined in uikon.rh).
{
BYTE version; // version number
WORD flags;
WORD height; // in items
WORD width; // in chars
LLINK array_id; // points to items in ARRAY structure
}
ListBox content (items) are also represented by a resource. Items are described using ARRAY structure (also in uikon.rh). Each individual item is defined using LBUF resource structure.
{
STRUCT items[];
}
In an application resource file (.rss), a listbox definition will look something like this:
{
flags = EAknListBoxSelectionList;
array_id = r_mylistbox_items;
}
RESOURCE ARRAY r_mylistbox_items
{
items =
{
LBUF { txt = "Item1"; },
LBUF { txt = "Item2"; },
LBUF { txt = "Item3"; }
};
}
(An application can have any number of LISTBOX and ARRAY structures.)
The C++ code that reads above LISTBOX resource could look something like this:
ListBox Container code:
CEikColumnListBox* listBox = new (ELeave) ...;
TInt resourceId = R_MY_LISTBOX;
TResourceReader reader;
iEikonEnv->CreateResourceReaderLC(reader, resourceId);
listBox->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy(); // resource pushed in CreateResourceReaderLC
// create listbox scrollbar...
// set icons...
SizeChanged();
listBox->ActivateL();
DrawNow();






why can't I use CEikColumnListBox ?
> why can't I use CEikColumnListBox ?
generally when u do not add library for that particular control in .mmp file then linking error occurs, add eikctl.lib and include eikclb.h as a header file and try, i think then it will work.
All the best
Amit
> ListBox: Part VII
i have added this code in .rss and ...container.cpp but it gives 'R_MY_LISTBOX' : undeclared identifier
how can i solve?
> ListBox: Part VII
ListBox: Part VII
What's this .rsg file?
When I try to compile my code I always get this error "the file *.rsg cannot be opened"
Re: ListBox: Part VII
How can I change the view from List view to Grid View and Vice versa?