RE: Notebook -> signal when a tab is clicked



Hi everyone!

Hi,


I want to run a function each time a tab is clicked.

I've tried:

(Considering NTB : the widget "notebook",  FUNC the "function")

  gtk_signal_connect(GTK_OBJECT(ntb), "clicked", GTK_SIGNAL_FUNC
(func), NULL);

It just says (on GTK1.2):

Gtk-WARNING **: gtk_signal_connect(): could not find signal "clicked" in
the `GtkNotebook' class ancestry

You may be able to get away with the "clicked" signal or perhaps the "button_press_event" for the 
GtkLabel/GTkWidget that is used for the header.  The problem with this is, what happens if the tabs are 
changed via the keyboard. - You would also then have to use "key_press_event" and it all just looks messy 
then.



I've also tried the event "switch-page" but then it just gets crazy and
begins jumping around from one tab to another... for instance, if you
click the tab 2 from the tab 0 it begins tab-2 tab-0 tab-2 tab-0 tab-2...
and so... :/


If the switch-page doesn't work, try "change-current-page", I think that's the signal I use.  There is always 
"select-page" too.  See the docs for more info (this area of the documentation really needs improving):

http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#GtkNotebook-change-current-page

Regards,
Martyn



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