[gtkada] adding and removing widgets in a container

Emmanuel Briot briot at ACT-Europe.FR
Thu Nov 29 10:03:26 CET 2001


"Torsten Leistikow" <leistikow at stn-atlas.de> writes:

> No problem here.
> 
> Remove (Frame, Label);
> 
> No Problem here.
> 
> Add (Frame, Label);
> 
> Now I get the error message
> 
> gtk-CRITICAL **: file gtkcontainer.c: line 714 (gtk_container_add):
> assertion `GTK_IS_WIDGET (widget)´ failed

Do not forget that widgets are reference-counted. When you remove it from its
parent, its reference count is 0, and the widget is destroyed. You thus need to
call Gtk.Object.Ref on it before doing the remove.
Check the User's guide for more information

Emmanuel




More information about the gtkada mailing list