Re: Deactivate tabs in GtkNotebook



On Fri, 2006-05-12 at 12:36 -0400, Ken Siersma wrote:
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. 

Are you sure you want to use a notebook paradigm?  This strikes me has
having some pretty severe usability issues.  For example, does the user
have to click on the next tab when it becomes available, or is it
switched to that automatically when the time comes?  Either way this is
confusing to the user and does not represent the way a user normally
interacts with a dialog box that contains tabs.  

What you are describing is more of a wizard-like interface with discreet
steps.  The only thing is that you state you want the user to know
what's coming.  This appears to me to be better done with a wizard-like
dialog box with a "Next" button, and maybe a frame on the left side of
the dialog box that lists all the steps and places a pointer on the
current step.  This is typically how most UI's accomplish this. 

Michael



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


_______________________________________________
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]