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

Re: Page numbers in GtkNotebook



The page number depends on its location in the graph notebook I believe, so
if you delete tabs before it the number will change.  This works fine for
things like removing:

  gint page;
  page = gtk_notebook_get_current_page (myGraphData->notebook);
  gtk_notebook_remove_page (myGraphData->notebook, page);


But what I did when I needed a specific tab was the following:

  // Get the current notebook tab
  int currentPageIndex = gtk_notebook_get_current_page(myData->notebook);
  GtkFrame *currentPage = GTK_FRAME(gtk_notebook_get_nth_page
                                          (myData->notebook,
                                           currentPageIndex));

Then you can get the notebook label or the widget name or something else to
uniquely identify which tab is actually open.

I'm not sure if this is ideal, but it worked for me.

Audrey

----- Original Message -----
From: "Manu C S" <manu@sumerusolutions.com>
To: <gtk-app-devel-list@gnome.org>
Sent: Tuesday, April 15, 2003 11:50 AM
Subject: Page numbers in GtkNotebook


> Hi,
>
> How does one find out the page numbers of tabs in GtkNotebook?
> I tried gtk_notebook_get_current_page() in a callback for
> switch page signal, but the page number I get from this varies
> each time.
>
> I want to be able to do something like this in my code:
>
> -------------------------------------------------------------
> #define PAGE_0  0
> #define PAGE_1  1
> #define PAGE_2  2
> ...
>
> on_top_switch_page (GtkNotebook* notebook, ....)
> {
>     curr_page = gtk_notebook_get_current_page(notebook);
>
>     switch (curr_page) {
>         case PAGE_0:
>             break;
>         case PAGE_1:
>             break;
>             ....
>     }
> }
> -------------------------------------------------------------
>
> I found this question asked in the archives (2000-Jul), but
> I couldn't locate any suitable answers.
>
> Can anyone please help? It's rather urgent.
>
> Thanks,
> Manu
>
> _______________________________________________
> 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]