Re: GtkNotebook "switch-page" Signal



This is a typical callback for the switch-page signal:

void my_callback (GtkNotebook *notebook,
GtkNotebookPage *notebook_page, int page, void *data)
{
GtkWidget* vbox_page;

vbox_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page);

1) page is the number (0 = first page, etc.) of the NEW notebook page.

2) vbox_page is the container that you used to build that NEW page, using code such as this:

vbox_page = gtk_vbox_new (FALSE, 0);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);

3) if you really need the old page, just save it yourself (for example, a static variable (C) in the callback will do). I have some extensive experience with GTK notebooks, they work quite well. I don't remember a single case where I needed the old page (what a notebook page shows or does should not depend of the page previously selected by the user...)

Regards,
Carlos
David NeÄas wrote:
On Fri, Jan 08, 2010 at 05:59:27PM -0500, dhk wrote:
When changing from one tab to another in a GtkNotebook I often need to
know the tab that was selected.  It seems the "switch-page" signal just
tells the current page and there are functions that tell the current
page and will navigate through the page, but I don't see anything that
will tell tell the destination page or the tab that received the signal.

Does anyone know how to determine this?
"switch-page" gives you the new page (i.e. the page the notebook is
switching to).  What is `destination' page if not this?

Yeti



It looks like it gives the page I switched from, but I want the page I
switched to.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]