I met a problem about inserting an item to a ListBox with icons.
After I opened and converted an jpg file to a *CFbsBitmap, and set it to CGulIcon, then I inserted this CGulIcon to ListBox's icons array. But after this two icons of the ListBox were changed, not one! Could someone who knows this reason help me? My code is just like this:
//--------------------------------------------------
// 1. the text of ListBox
CDesCArray* listboxArray = STATIC_CAST(CDesCArray*, iListBox->Model()->ItemTextArray() );
CleanupStack::PushL( listboxArray );
TBuf<50> tListItem;
tListItem.Append(_L("1\FirstLine\tSecondLine"));
listboxArray->InsertL(1,tListItem);//insert an item at pos 2
// 2. Add this item
iListBox->HandleItemAdditionL();
CleanupStack::Pop(); // listboxArray
// 3. use .jpg file as icons on ListBox
CGulIcon* myIcon = CGulIcon::NewL();
CleanupStack::PushL( myIcon );
myIcon->SetBitmap( iBitmapJpg ); //iBitmapJpg is a *CFbsBitmap
icons->InsertL( 1, myIcon ); //insert an icon at pos 2
Hi folks, There are code fragments in the following for inserting bitmap icon. I guess that it is the problem with SetBitmap() method. It is crasing when I try to run the program. It would be very much appreciable to get your comments on it.
CGulIcon* myIcon = CGulIcon::NewL();
CleanupStack::PushL( myIcon );
myIcon->SetBitmap(iBitmap); //iBitmap is a *CFbsBitmap
//It is crashing when I try to set iBitmap object.