RE: [gtk-list] notebook pages & callbacks?



On 11-Apr-98 Jorgen Pehrson wrote:
> Hi,
> I have created a notebook which contains three pages. Now I would like to
> connect a callback function to one of the pages, so when the user clicks
> on the page tab it should first perform my callback function. How do I do
> that?
> Can I just use "gtk_signal_connect", and if I can, what object do I
> connect the signal to?

Try the following :

gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
                    (GtkSignalFunc) page_switch, NULL);

together with :

static void
page_switch (GtkWidget *widget, GtkNotebookPage *new_page, gint page_num)
{
  if (page_num == your_page_num)
    { 
        /* your code */
    }
}

bye,
   Stefan



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