Adding up icons in a List Box
| Sat, 2006-04-08 07:51 | |
|
Hello
I am trying to addup icons in a List Box and inorder to do that I tried out the function CreateIconL to create icons and was successful in doing that The syntax used is as follows: Code: CGulIcon* CreateIconL(const TDesC& aFileName,TInt aBitmapId,TInt aMaskId); But this function takes up the enumerations present in the .mbg file to create those icons What I want to do is use the NewL method of the CGulIcon class to create an icon The syntax is as follows: Code: static CGulIcon* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL); Now from the above syntax it doesnot use enumerations rather it uses an instance of CFbsBitmap class I used this function as i had the CFbsBitmap instance with me but I receive a panic in he emulator stating AVKON 0 I have also checked the instance of CFbsBitmap which is NOT NULL Can somebody help me out in this ?? Regards, Yogesh Khanolkar |
|






Forum posts: 114
void CSypherSMSContainer2::SetupListIconsL()
{
// Get the name of the file containing the icons
HBufC* iconFileName;
iconFileName = StringLoader::LoadLC(R_ICON_FILE_NAME); // Pushes iconFileName onto the Cleanup Stack.
// Create an array of icons, reading them from the file
CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(KNumberOfIcons);
CleanupStack::PushL(icons);
icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmSyphersms1player, EMbmSyphersms1player_mask));
icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmSyphersms2player, EMbmSyphersms2player_mask));
icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmSyphersmsDot, EMbmSyphersms2player_mask));
CleanupStack::Pop(icons);
CleanupStack::PopAndDestroy(iconFileName);
iMainMenuListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); // passing ownership of icons
}
and then setup the icons id in .l01 file.