Changing views using ListBoxes

Login to reply to this topic.
Mon, 2006-03-27 14:03
Joined: 2006-02-17
Forum posts: 4
Hi!

I'm trying to create an application using the view architecture. I've 2 different views, each one being a Listbox implementation.
I've set their containers classes to the be the Listbox observers.
What I want to do is use a listbox option in the first one to change to the second listbox (the other view) but I can´t get a way to pass the events from the container to the AppUi.

Something like this in the first view container:

void CviewTestContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aListBoxEvent)
   {
   // if the Select Key has been pressed
      if (aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed)
      {
         TInt index = aListBox->CurrentItemIndex();
         if (index == 0)
            // Call something in the AppUi that changes the view and creates the listbox according to the option selected
         if (index == 1)
                // Create another listbox
      }
   }

Does anybody have any idea how it can be done?

Thanks

Sergio

Mon, 2006-03-27 17:14
Joined: 2004-08-19
Forum posts: 112
Re: Changing views using ListBoxes
I'm not sure I understand you right. Is it your problem that you don't know how to call something in your AppUi? The usual way is to use something like this:

Code:
CMyAppUi* MyAppUi = (CMyAppUi*) AppUi ();

and then you can call eg. MyAppUi->ActivateLocalViewL() without any problem.

Bye,
  Gábor

Bye,
Gábor

Tue, 2006-03-28 11:42
Joined: 2006-02-17
Forum posts: 4
Re: Changing views using ListBoxes
That's exactly it!
I created the CMyAppUi* MyAppUi in the view and then pass it to the container, that way i can define a function to handle the selection of an option in the listbox and create the new listbox based on that data.

thanks for your help  Grin

Sérgio
  • Login to reply to this topic.