List Box event
| Sun, 2007-07-15 20:57 | |
|
Hi All, all what i want is, how can i handle the listbox items to add a diiferent event for each one separetly. thanks |
|
| Sun, 2007-07-15 20:57 | |
|
Hi All, all what i want is, how can i handle the listbox items to add a diiferent event for each one separetly. thanks |
|
Forum posts: 1058
You don't add "events" per se to list box items, or "connect" them somehow with list box items.
You simply implement a HandleListBoxEventL method, e.g. in the class of the container of ListBox, that is called when any list box item is selected. There you can react in way you want, e.g. differently to the selection of the first and the selection of the second element.
Btw, did you see that you somehow managed to post the same 4 times?
René Brunner
Forum posts: 7
Hi,
thank you, i solved it by a very simple way as follows
void CMyAppListBoxDialog::HandleListBoxEventL(CQikListBox* aListBox, TQikListBoxEvent aEventType, TInt aItemIndex, TInt /*aSlotId*/)
{
if(aEventType==MQikListBoxObserver::EEventItemTapped)
{
MQikListBoxData* listBoxData = aListBox->Model().RetrieveDataL(aItemIndex);
if(listBoxData->Text(EQikListBoxSlotText1)==KTextItem)
{
LaunchSelected FileDialog();
}
else if(listBoxData->Text(EQikListBoxSlotText1)==KTextItem2)
{
CMyAppPGridListBox::RunDlgLD();
}
listBoxData->Close();
}
}
//KTextItem and KTextItem2 represent the listbox item text
and by this way, ican handle each any list box data item, but i'm sure that there are an abetter way to do the same thing specially if if have more that 10 listbox items and each of them need a different event.