List Box event

Login to reply to this topic.
Sun, 2007-07-15 20:57
Joined: 2007-06-23
Forum posts: 7

Hi All,
i'm work in application use the ListBox component, i was added two listBox Items with different names, when the user select one of them, a grid view should be open to the one and selectFileDlg should be open for the another.

all what i want is, how can i handle the listbox items to add a diiferent event for each one separetly.

thanks


Mon, 2007-07-16 07:23
Joined: 2005-11-20
Forum posts: 1058
Re: List Box event

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

Mon, 2007-07-16 13:27
Joined: 2007-06-23
Forum posts: 7
Re: List Box event

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.

  • Login to reply to this topic.