Hi,

S60 3rd Ed / carbide .vs / Emulator

I have some problems to create icons for my listbox.
I hope I have understand the process of creating icons well.


1) I have a mbm file with 2 icons in it, checked with bmconv tool, seems ok
(means, looks like an example in der sdk)

2) the mbm file is stored in C:\Symbian\9.1\S60_3rd_MR\Epoc32\release\winscw\udeb\z\resource\apps
(here Im not sure if it is right so)

3) I want to avoid to much resource identifiers.
I prefer this way:

void CtestAppView::ConstructL( const TRect& aRect )
{
// Create a window for this application view
CreateWindowL();
SetRect(aRect);

TBuf<10> cont = _L("head");
_LIT(KListItemFormat, "%d\t%S\t%S");
iListBox = new (ELeave) CAknSingleGraphicHeadingStyleListBox;
iListBox->SetContainerWindowL(*this);
iListBox->ConstructL(this);
const TPoint aPoint(0,0);
iListBox->SetExtent(aPoint,aRect.Size());
// construct listbox item array
CDesCArray *itemList = new (ELeave) CDesCArrayFlat(3);
TBuf<32> item;
item.Format(KListItemFormat, 0, &cont, &cont);
itemList->AppendL(item);
item.Format(KListItemFormat, 0, &cont, &cont);
itemList->AppendL(item);
item.Format(KListItemFormat, 0, &cont, &cont);
itemList->AppendL(item);
// set items and ownership
iListBox->Model()->SetItemTextArray(itemList);
iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);

CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(1);
CleanupStack::PushL(iconList);

_LIT(KIconFile, "\\resource\\apps\\test_reg.mbm"); //?????
CFbsBitmap* iBitmap;
CFbsBitmap* iMask;

iBitmap = AknIconUtils::CreateIconL(KIconFile,1);
iMask = AknIconUtils::CreateIconL(KIconFile,1);

CleanupStack::PushL(iBitmap);
CleanupStack::PushL(iMask);
iconList->AppendL(CGulIcon::NewL(iBitmap,iMask));

iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
CleanupStack::Pop(); // iconList // update listbox
iListBox->HandleItemAdditionL();

ActivateL();
}


I never used resources in Symbian before.
Is this in principle right? My test application crashes somewhere in CtestAppView::NewLC.


Best regards
Daniel