I've been trying to set and display different icons for different items in the listbox, does anybody know how to get it?
I've tried to add several different icons into CAknIconArray, and I also used formal method to set icon array:
aListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
however, only the first icon in the CAknIconArray would appear in the actual listbox, is it possible to change the icons corresponding to different items?
Thanks a lot~~~
you basically need to tell the listbox which icon to use and where. This is done in your text array.
And there for your icon column you just specify the ordinal number of the icon. Remember that first icon in your icon array corresponds to the zero, so the ordinal number for the last icon is Count() -1;
But I still have no idea how to set the icon properties in the text array. I got the text array as follows:
MDesCArray* itemList = iListBox->Model()->ItemTextArray();
CDesCArray* itemArray = (CDesCArray*)itemList;
and I didn't find any potential functions about icon settings in the itemArray class......Actually I don't know how to get / set the relationships between the icon array and the text array.
By the way, I didn't generate my ListBox from resource, just set the items dynamically by appending new items into the itemArray, or maybe I've something special to do during this appending process?
Regarding the icon array, I think it has already been generated according to my inserting order of the icons, so I don't have to do anything else?
The most painful thing, I have to say, is that I cannot find any information concerning this topic in the Symbian documentation, and the "listbox" sample code is a little bit too complicated
>only the first icon in the CAknIconArray would appear in the actual listbox
hmm, how does your strings in item array look like? The format of one strings can be for example something like this (it depends on the type of a listbox):
<icon number>\t<string>\t<other string>
0\tfirst item\tsecond string
1\tsecond item\tsecond string
2\t third item\tsecond string