Re: Please: Explain what happens when on use gtk_container_remove



Preben Randhol <randhol pvv org> writes:
> 
> I do this (note the code is not in C as I use Ada 95, but it should be
> understandable)
> 
>    Gtk.Container.Add (Some_Vbox, Some_Frame);
>    Gtk.Container.Remove (Some_Vbox, Some_Frame);
>    Gtk.Container.Add (Some_Vbox, Some_Frame);
> 
> As I understand the documentations the Remove should not alter the
> Some_Frame widget, but at the second Add I get:
> 
>  Gtk-CRITICAL **: file gtkcontainer.c: line 714 (gtk_container_add):
>  assertion `GTK_IS_WIDGET (widget)' failed.  
> 
> Why do I get this? And how can I Remove a widget from a container
> temporarily while I Add a different widget to the container and then
> Remove this to place back the first again? If you can show me this in C
> or plain English I'll understand :-).
> 

The container owns the only reference to the frame, so it gets
finalized.

Try:
 add (frame);
 ref (frame);
 remove (frame);
 add (frame);
 unref (frame);

Havoc




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