Re: manipulating things packed into GtkContainers



Shark wrote:

Hello,

 In the application I'm working on I have a GtkVBox which holds two
 widgets (a GtkCheckButton and a GtkTreeview) and I would like to remove
 both of those and put in different widgets of the same type, and I'd
 like to add them to the container so they are in the same order as the
 ones I removed.
Right now I can get the widgets by getting the GList of children from
gtk_container_get_children(), and traversing the GList until
GTK_IS_CHECK_BUTTON or IS_TREEVIEW returns true... but is there any
GtkContainer function to get the position of an argument widget *, and
another function to insert the given widget * into a given position?
I know I could just use gtk_box_pack_start() or _end() to add the
checkbutton or treeview to the top or bottom of the VBox, but I had hoped
to be able to modify the order of those two widgets in glade and just
replace them at run time with the widgets I'd actually create in my code.
 (And there are actually like three treeviews I'll be switching between,
so I can't just use the one that glade produces.)
If anyone understands me well enough to help, that'd be great. :) Thanks!

-Peter

p.s. what would be really nice is if I could just do
gtk_container_switch(container, widget_to_remove, widget_to_replace).
Hi,
I think you can do this with:
gtk_widget_reparent() - http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-reparent gtk_box_reorder_child() - http://developer.gnome.org/doc/API/2.0/gtk/GtkBox.html#gtk-box-reorder-child

   Olexiy




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