Date: Mon, 13 Oct 2003 15:24:56 +0100 Cc: lablgtk at kaba.or.jp Subject: Re: Bug when changing the contents of a frame Message-ID: <20031013142456.GC26162 at redhat.com> References: <20031013133019.GA26162 at redhat.com> <16266.45995.39355.140798 at akasha.ijm.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16266.45995.39355.140798 at akasha.ijm.jussieu.fr> From: Richard Jones On Mon, Oct 13, 2003 at 04:16:11PM +0200, Olivier Andrieu wrote: > Richard Jones [Monday 13 October 2003] : > > Fatal error: exception Glib.Critical("Gtk", "file gtkcontainer.c: > > line 984 (gtk_container_remove): assertion `widget->parent == > > GTK_WIDGET (container)' failed") > > that means you're calling some_container#remove some_widget but the parent > of some_widget is not some_container. Indeed, in your code, the value > returned by show 2 and stored in the reference is a GMisc.label contained > in a vbox. show 2 should return the vbox, not the last widget added to > it. Hmmmm ... that was a bug in my minimal example. The real program is of course much larger, so I'll need to go back and see if I can reproduce it now :-) > BTW, since a GtkFrame is a GtkBin, it can only contain one widget. So > your code could be simplified ; you can drop the reference cell and > define remove that way : > > let remove () = frame#remove (List.hd frame#children) OK. I tried doing this before: List.iter (fun w -> frame#remove w) frame#children but that removed the label widget (part of the frame itself), which was rather drastic. Is frame#children guaranteed to return the child widgets in a known order? Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles, RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/