ListBox and icon problem....
| Fri, 2005-08-12 10:38 | |
|
hello all
i have problem with listbox and icon here is my code what i have written in the CMyFirstAppContainer::ConstructL(..) { iListBox = new (ELeave) CAknSingleLargeStyleListBox(); iListBox->SetContainerWindowL(*this); iListBox->ConstructL(this,EAknListBoxSelectionList); array = new (ELeave) CDesCArrayFlat(KGranularityOfArray); CleanupStack::PushL(array); array->AppendL(_L("0\tFirst item")); array->AppendL(_L("0\tSecond item")); array->AppendL(_L("0\tThird item")); array->AppendL(_L("0\tFourth item")); array->AppendL(_L("0\tFifth item")); CleanupStack::Pop(); iListBox->Model()->SetItemTextArray(array); iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); //CArrayPtr* iconList = new (ELeave) CAknIconArray(5); CArrayPtr<CGulIcon>* iConList = new (ELeave) CAknIconArray(1); CleanupStack::PushL( iConList ); //iConList->AppendL(iEikonEnv->CreateIconL(KMultiBitmapFilename, 2, -1));//EMbmSmsorLog, EMbmSmsorLog_mask iConList->AppendL(iEikonEnv->CreateIconL(_L("c:\\System\\Apps\\Myfirstapp\\Myfirstapp.mbm"), EMbmTestImage2)); CleanupStack::Pop(iConList); //iListBox->iItemDrawer()->ColumnData()->SetIconArray(iConList); //iConList->AppendL(iEikonEnv->CreateIconL(KMultiBitmapFilename, EMbmIconIcon_24x24i,EMbmIconIcon_24x24m)); CFormattedCellListBoxItemDrawer* drawer = (CFormattedCellListBoxItemDrawer*)iListBox->View()->ItemDrawer(); drawer->ColumnData()->SetIconArray(iConList); CleanupStack::Pop(); //iListBox->HandleItemAdditionL(); iListBox->SetListBoxObserver(this); SetRect(aRect); ActivateL(); } where is the problem? i can display the listbox without icon but how can i display listbox and icon both please give some tips thanks bashar |
|






Forum posts: 142
yucca
Forum posts: 27
i have tried with that but it doesn't work
anyway thanks
bashar
Forum posts: 732
{
//Delete the list box if already exists.
if ( iListBox )
{
delete iListBox;
iListBox = NULL;
}
// listbox instance
iListBox = new (ELeave) CAknSingleLargeStyleListBox();
iListBox->ConstructL(this, EAknListBoxSelectionList);
iListBox->SetContainerWindowL(*this);
// add scrollbars to listbox
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn,
CEikScrollBarFrame::EAuto );
const TPoint aPoint(0,0);
const TSize aSize(180,150);
//most important line , else the list box simply disappears
iListBox->SetExtent(aPoint,aSize);
//Fill list box with the data
InitListBox();
iListBox->ActivateL();
iListBox->DrawNow();
iCtrlArray.Append( iListBox );
}
void CMyAppContainer::InitListBox()
{
CDesCArray *itemList = new (ELeave) CDesCArrayFlat(KGranularityOfArray);
itemList->AppendL(_L("0\tItem01"));
itemList->AppendL(_L("1\tItem02"));
itemList->AppendL(_L("2\tItem03"));
//...
// set items and ownership
iListBox->Model()->SetItemTextArray(itemList);
iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
iListBox->SetCurrentItemIndex(0);
iListBox->SetFocus(ETrue);
CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(KGranularityOfArray);
CleanupStack::PushL(iconList);
_LIT( KIconFile,"z:\\system\\data\\avkon.mbm");
iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_ok, EMbmAvkonQgn_note_ok_mask) );
iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_bt, EMbmAvkonQgn_note_bt_mask) );
iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmAvkonQgn_note_sml, EMbmAvkonQgn_note_sml_mask) );
iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
CleanupStack::Pop(); // iconList
iListBox->HandleItemAdditionL();
}
Forum posts: 182
how to giv different icons for each coloum?
hoping help
regs Julie
To err is human; to forgive, divine
Forum posts: 2
vin2ktalks how are you declare iListBox in CMyApContainer.h?
Forum posts: 732
Forum posts: 45
Hi vin2ktalks,
what is this array:--
iCtrlArray.Append( iListBox );
in the last line of CreateListBoxL() doing?
could u plz reply? I'm following ur code to make a graphics list box.
Tushar Bhattacharyya