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

CEikColumnListBox init

1 replies · 2,332 views · Started 30 June 2004

Hi
here is the relevant RSS and CPP code regarding a CEikColumnListBox .
when executing the APP I get a very weird list box .(with no row in it , no data and no icon).

please take a look at the code and help me chenge it in order to init the list box with one item with an icon

// ***** in the RSS file ***** 
RESOURCE DIALOG r_listbox_dialog
{
title="List Box";
buttons = r_listbox_buttons;
flags=EEikDialogFlagWait;
items=
{
DLG_LINE
{
type=EEikCtListBox;
prompt="List Box";
id=EMyAppControlIdListBox;
control=LISTBOX {};
}
};
}

// ***** in the CPP file *****
void CMyAppDialog::PreLayoutDynInitL()
{
iColumnListBox = static_cast<CEikColumnListBox*>(Control(EMyAppControlIdListBox));
iColumnListBox->ConstructL(this);
iColumnListBox->SetContainerWindowL(*this);
iColumnListBox->CreateScrollBarFrameL(ETrue);
iColumnListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
CColumnListBoxData * data = (CColumnListBoxData*) new CListBoxData();

iColumnListBox->ItemDrawer()->SetData(data);
CArrayPtr<CGulIcon>* iconList = getIconList();
iColumnListBox->ItemDrawer()->ColumnData()->SetIconArray(iconList);
CDesCArray* listBoxArray = getListBoxItems();
CTextListBoxModel* model = iColumnListBox->Model();
model->SetItemTextArray(listBoxArray);
model->SetOwnershipType(ELbmOwnsItemArray);
}

CDesCArray* CMyAppDialog::getListBoxItems()
{
CDesCArray* tempListBoxArray = new(ELeave) CDesCArrayFlat(1);
_LIT(KItemName,"MyNewItem"😉;
TBuf<32> item;
item.Format(_L("\t%d %S"😉, 0, &KItemName);
tempListBoxArray->AppendL(item);
return tempListBoxArray;
}

CArrayPtr<CGulIcon>* CMyAppDialog::getIconList()
{
_LIT(KIconsFilename, "\\system\\apps\\MYAPP\\MYAPP.mbm"😉;
CArrayPtr<CGulIcon>* iconList = new (ELeave) CArrayPtrFlat<CGulIcon>(10);
iconList->AppendL(iEikonEnv->CreateIconL(KIconsFilename,0,1));
return iconList;
}

hi,

white_dragon ! I am not replying ur question but I am asking to u..

please tell me the steps to create a simple list (CAknColumnList) program that contains few element.

and some other questions

1) Why have u chosen CEkiColumnList, why not CAknCoulmnList ?

2) Do I need to use .rss file to add each type of control in my application? If yes then how can know what resource do I need to use?

I shall b thankful to u.

dotcdotc