Re: GtkNotebookPage



On Sun, 2007-09-30 at 10:07 -0400, dhk wrote:

I have a notebook with a treeview on each page.  I'm trying to reference
a treeview on a notebook tab when it is clicked and compare it to
another treeview on another tab; I'm using the "switch-page" signal.
The treeviews are in vbox's in the tabs and I can't seem to get to the
one on the tab that was clicked.  The callback is like this . . .

void
on_ipm_notebook1_switch_page      (GtkNotebook     *notebook,
                                        GtkNotebookPage *page,
                                        guint            page_num,
                                        gpointer         user_data)
{
  GtkWidget *tv=(GtkWidget *)user_data;
  /* the treeview is in c_page */
  GtkWidget *c_page=gtk_notebook_get_nth_page(notebook, page_num);

}



When creating the notebook page and treeview.  set the treeview's
pointer into the vbox as userdata, then during the callback routine get
that userdata or pointer.  now you have the pointer to the treeview,
preform normal treeview operation.

During Create:
g_object_set_data (G_OBJECT(vbox), "TreeView-ptr", (gpointer)ptreeview);

During Callback:
treeview = (GtkTreeView *)g_object_get_data (G_OBJECT(page),
"TreeView-ptr");

Note: from the callback param list, '*page' is the value you supplied to
'gtk_notebook_append_page(p1, p2,p3)' as p2.  This would normally be
your vbox.

James,


How would I get the treeview that's on the c_page?  Is there a way to
send more than one object in with user_data?  user_data doesn't seem to
like pointer-to-pointer (GtkWidget **tv) data.

Also, what can you do with the GtkNotebookPage object?  I don't see why
this is passed in since there doesn't seem to be a way to use it.

Thanks in advance,

--dhk

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