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

Re: table removal of widgets solved



>  eh nremoving a child from a container (as in my previous message) i found
>  out that the child gets destroyed, and MUST be re-created if it is to be
>  reused.

Actually, it just gets its reference count decremented.  If the
refcount reaches 0, then the object is destroyed.  So if you want to
keep it alive, you should ref/unref it when you unparent it:

	GtWidget *my_widget;

	my_widget = some_widget_new ();
	gtk_widget_ref (my_widget);
	gtk_object_sink (GTK_OBJECT (my_widget));
	gtk_container_add (some_container, my_widget);

	...

	gtk_container_remove (some_container, my_widget);
	gtk_container_add (some_other_container, my_widget);

	...

	gtk_widget_unref (my_widget);

Please read the refcounting document in the gtk+/docs directory.

  Federico



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