[maemo-developers] [maemo-developers] Switching between appviews ...
From: Kalle Vahlman kalle.vahlman at gmail.comDate: Sat Jul 2 09:15:22 EEST 2005
- Previous message: [maemo-developers] Switching between appviews ...
- Next message: [maemo-developers] Switching between appviews ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 7/2/05, Jorge Souza <sao_jorge31 at yahoo.com.br> wrote: > Hi all, > > I wonder if someone could help me with a relative > newbie question. Actually, I'm not able to make the > switch between two 'hildonappviews' work properly. That's because you are using them improperly ;) > What I am trying to do is basically build two > different HildonAppView with some widgets in them, and > switching between these appviews using the hildon > environment task navigator (with the mouse/stylus). It's easy! > Following is the code that handles this switching > (inside the "switch_to" signal callback): > > <quoted> > > gtk_container_remove(GTK_CONTAINER(appview), > GTK_WIDGET(label_test1)); > gtk_container_add(GTK_CONTAINER(appview), > GTK_WIDGET(label_test2)); > gtk_widget_show(GTK_WIDGET(label_test2)); > > hildon_app_notify_view_changed(appview, label_test2); > > </quoted> The switching needs no widget juggling, the only thing that is actually reparented is the appviews, but that's an implementation detail. The proper way to do this is to: 1) create an HildonApp 2) create two or more HildonAppViews 3) register other AppViews with the app: hildon_app_register_view (HILDON_APP (app), appview2); 4) set the initially visible/active appview: hildon_app_set_appview (HILDON_APP (app), appview); and you are done. Nothing else is needed (well, populating and showing the views and the app is a good idea of course). The point 3/4 ordering is important it seems (this is a bug I think). Also note that the appview set with set_appview() should not be registered as this happens automatically (at least if you haven't set autoregistration to FALSE, it defaults to TRUE). The "switched_{to,from}" signals are just to notify your application that the switch is made, in case you want to do something special in your app when that happens. > Am I missing something !? What am I doing wrong ?! You just confused appview with app, I think. <hint for documentation people> There really should be a tutorial with multiple appviews on maemo.org. </hint for documentation people> > ps: if this is not the correct mail list to make > question like mine, could you point me the right one > !? This is just the right one, another place to ask is the IRC-channel #maemo on freenode. -- Kalle Vahlman, zuh at iki.fi
- Previous message: [maemo-developers] Switching between appviews ...
- Next message: [maemo-developers] Switching between appviews ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]