Re: [gtk-list] Reparenting a widget



On Mon, Jun 08, 1998 at 07:54:39AM -0600, Kevin Pearson wrote:
> I'm having difficulties trying to remove a widget from a container and
> add it to a different one.  I found that if I use
> gtk_widget_unparent(widget), or gtk_container_remove(container, widget),
> then widget becomes NULL.

This is because of reference counting. Widgets get invalid if the
reference counter reaches 0. So the best way is to call gtk_widget_ref
after you create it, or to gtk_widget_ref it each time before you do a
container_remove, and gtk_widget_unref it after a container_add.

-- 
Eckehard Berns



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