Re: Detach a widget from container



On Wed, 6 Sep 2000, Jan Jirmasek wrote:

 Hi, 

 gtk_widget_reparent(GtkWidget *widget, GtkWidget *new_parent) can be used for
 this, but FAQ recommends the following code (see FAQ why):

     gtk_widget_ref(widget);
     gtk_container_remove(GTK_CONTAINER(old_parent), widget);
     gtk_container_add(GTK_CONTAINER(new_parent), widget);
     gtk_widget_unref(widget);

> Hi!
> 
>   I have the following problem. I have a container widget (a vbox) and a
> widget packed into this container:
> 
>     gtk_container_add(GTK_CONTAINER(container),vbox);
> 
>   I need to detach the vbox from the container without destroying it. I
> tried first the gtk_container_remove(), but it destroys the child
> widget. Do you know, how could I do it? I need the widget later for
> inserting into another container, and it would be terrible waste of time,
> if I'd have to destroy it and then later create it again...
> 
> 
>   							Jim
> 
> 
> PS: The documentation for GtkWidget and GtkContainer contains only empty
> lines and in the source I wasn't able to find the function I'm looking
> for... Is anyone going to fill something in the documentation about the
> GtkWidget, GtkContainer widgets? It would be _very_ helpful!
> 

 Best regards,
  -Vlad





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