Deactivate tabs in GtkNotebook
- From: Ken Siersma <siersmak ekkinc com>
- To: gtk-app-devel-list gnome org
- Subject: Deactivate tabs in GtkNotebook
- Date: Fri, 12 May 2006 12:36:02 -0400
Hi list,
I'd like to create a notebook that has 5 different pages in it, but the
data to be displayed in the later pages depend on the first page. I
want the tabs for all pages to be shown in the notebook, to indicate to
the user that they need to step through the last 4 too, but I don't want
them to be able to select those tabs until they complete the form in the
first page.
So, I figured I could create all 5 pages and just deactivate the last 4
somehow. The way I am trying to do it is to set the sensitivity of the
last 4 tab label widgets to FALSE, which gives the appearance that those
tabs cannot be selected. Then, I've setup a switch-page function for
this notebook which checks if the tab is not sensitive, and if so it
sets the current page in the notebook to 0:
void switch_page(GtkNotebook *nb, GtkNotebookPage *pg, guint page_new,
gpointer data)
{
int page_cur;
GtkWidget *label;
GtkWidget *child;
page_cur = gtk_notebook_get_current_page(nb);
child = gtk_notebook_get_nth_page(nb, page_new); /* Get child widget
of new page */
label = gtk_notebook_get_tab_label(nb, child); /* Get label for new
page */
if(!GTK_WIDGET_IS_SENSITIVE(label))
{
printf(" !! Not sensitive !!\n");
gtk_notebook_set_current_page(nb, 0);
}
}
The program outputs the "!! Not sensitive !!", but it still switches to
page_new and shows the (empty) contents of that page.
Any ideas?
-Ken
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]