I write a program use a grid view.When I run the program ,I see all the 9 icons as the first icon only.
Anyone knows what's the source of the problem?
Here is my code:
I think the problem is not in the icon list. because every item of the listbox has a number field which indicate the index of the icon in the icon list. By the way I think you can create your icon list use these codes :
CArrayPtr< CGulIcon >* icons = new(ELeave) CAknIconArray(KNumberOfBitmap);
CleanupStack::PushL( icons );
icons->AppendL( iEikonEnv->CreateIconL( pathAppMbm, EMbmIconsX,EMbmIconsXMask ) );
.
.
.
iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
CleanupStack::Pop();
As faqff pointed out in is post, the problem is not the code.
The problem is that you have to specify in the text array the icon index you want to use in that cell.
You associate an icon array with the grid and then you associate a string array.
Each element in this string array has a format like "1\tItem 1", where 1 is the index of the image you want to use from the icon array (0-based) and Item 1 is the text you want to use as label. These two fields are separated by a TAB character (\t)
If you have the same icon for all the grid cells, you must be using the same icon index for all of them.