Note that setting lists are not exactly lists, they are more like a special kind of a form, and in practice their API is one of the worst on Symbian.
For having a simple list, start with some simple text-mode listbox such as CAknDoubleStyleListbox:
Code:
void CSampleContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iListBox = new (ELeave) CAknDoubleStyleListBox;
iListBox->ConstructL(this, EAknListBoxSelectionList);
iListBox->SetContainerWindowL(*this);
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
FillListBoxL();
SetRect(aRect);
ActivateL();
}
CSampleContainer::~CSampleContainer()
{
delete iListBox;
}
void CSampleContainer::SizeChanged()
{
iListBox->SetRect(Rect());
}
TInt CSampleContainer::CountComponentControls() const
{
return 1;
}
CCoeControl* CSampleContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iListBox;
default:
return NULL;
}
}
void CSampleContainer::FillListBoxL()
{
CDesCArray* array = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
_LIT(KFormat, "\tItem\t%d");
TBuf<30> string;
for (int i=1; i<11; i++) {
string.Format(KFormat, i*100);
array->AppendL(string);
}
iListBox->HandleItemAdditionL();
}
TKeyResponse CSampleContainer::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
{
return iListBox->OfferKeyEventL(aKeyEvent, aType);
}
Where CSampeContainer is a CCoeControl, and iListBox is a CAknDoubleStyleListBox.