I want to create a listbox which contain a iconarray and a text column. I have used CAknSingleGraphicStyleListBox type listbox. I have used to resize the icon by using
AknIconUtils::SetSize(iBitmap,iSize,EAspectRatioPreserved);
But it still unchanged. How can i solve this problem. If do u have any way to create listbox with icon, please send me the sample code? Or please correct my code that is under below--
iList = new (ELeave) CAknSingleGraphicStyleListBox;
iList->ConstructL(this);
iList->SetContainerWindowL(*this);
iList->CreateScrollBarFrameL(ETrue);
iList->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
_LIT(KListItemFormat,"%d\t%S\t%d\t%d\t%S\t%S");
TBuf<30> aFirstArg;
aFirstArg.Append(_L("FirstArg"));
TBuf<30> aSecArg;
aSecArg.Append(_L("SecondArg"));
TBuf<300> Item;
itemList = new (ELeave) CDesCArrayFlat(3);
Item.Format(KListItemFormat,0,&(_L("head1")),1,0,&aFirstArg,&aSecArg);
itemList->AppendL(Item);
Item.Format(KListItemFormat,0,&( _L("head2")),0,1,&aFirstArg,&aSecArg);
itemList->AppendL(Item);
Item.Format(KListItemFormat,0,&(_L("head3")),1,0,&aFirstArg,&aSecArg);
itemList->AppendL(Item);
iList->Model()->SetItemTextArray(itemList);
iList->Model()->SetOwnershipType(ELbmOwnsItemArray);
CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(3);
CleanupStack::PushL(iconList);
TSize iSize;
iSize.iHeight=50;
iSize.iWidth=50;
AknIconUtils::CreateIconL( iBitmap,
iMask,
KIconFile,
EMbmListbox_modelQgn_listbox_model,
EMbmListbox_modelQgn_listbox_model_mask);
AknIconUtils::SetSize(iBitmap,iSize,EAspectRatioPreserved);
iconList->AppendL( CGulIcon::NewL( iBitmap, iMask ) );
AknIconUtils::CreateIconL( iBitmap,
iMask,
KIconName,
EMbmListbox_modelQgn_listbox_model,
EMbmListbox_modelQgn_listbox_model_mask);
iconList->AppendL( CGulIcon::NewL( iBitmap, iMask ) );
iList->ItemDrawer()->ColumnData()->SetIconArray( iconList );
CleanupStack::Pop();
iList->HandleItemAdditionL();
BR,
Sazzad

Reply With Quote

