Hi,
I want to set events on my list box items.Suppose, I have a list of groups as my list box items,and I want to view the group members when I press OK button.How do I it?
Printable View
Hi,
I want to set events on my list box items.Suppose, I have a list of groups as my list box items,and I want to view the group members when I press OK button.How do I it?
Hi
I think you could do that very easily in your container that owns your listbox, you just catch the command in your command handler function and tell your container to show the item.
Then in your containes showitem function you just take a pointer to your listboxes item array and get the item wanted to be shown and just show it anyway you want.
yucca
Thanks Yucca
Ur suggestion is going a bit too high above my head.Can u pls write a more detailed /simpler way so that I understand as I am new to Series 60 programming.Maybe some sample lines of code would help
Bye,
santosh
yucca,
Isn't MEikListBoxObserver required?
------------------------------------------------------------------
Well anyway here's how the SDK examples do it:
I may have added stuff here and there, anyone correct me if i'm having redundant code:
void CF2FContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
{
if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) ||
( aEventType == MEikListBoxObserver::EEventItemClicked ) )
{
switch(aListBox->CurrentItemIndex())
{
case 0:
//Display Group 1?
break;
case 1:
//Display Group 2?
break;
default:
User::InfoPrint(_L("Error"));
break;
}
}
}
-------------------------------------------------------------------------------
Somewhere inside u'r Container's OfferKeyEventL function, preferably at the end...
//*********Notice that if list->offerkeyevent is not used, HandleListBoxEvent for that
//*********particular list also does not run, so we don't get events from that list
if ( iFormattedListBox )
{
return iFormattedListBox->OfferKeyEventL(aKeyEvent, aType);
}
-------------------------------------------------------------------------------------
For all this to work, your container has to derive from MEikListBoxObserver as well, so mine is like this in the header file:
class CF2FContainer : public CCoeControl, public MEikListBoxObserver, MCoeControlObserver
Well hope this helps
Or u can refer to the gargantuan-like example AKNEXLISTBOX.
Preferably, read the SDK documentation on that example.
Series 60 > Series 60 Examples > Example Applications > Listbox control example