From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16266.49674.827696.214073 at akasha.ijm.jussieu.fr> Date: Mon, 13 Oct 2003 17:17:30 +0200 To: Richard Jones Cc: lablgtk at kaba.or.jp Subject: Re: Bug when changing the contents of a frame In-Reply-To: <20031013142456.GC26162 at redhat.com> References: <20031013133019.GA26162 at redhat.com> <16266.45995.39355.140798@akasha.ijm.jussieu.fr> <20031013142456.GC26162@redhat.com> Richard Jones [Monday 13 October 2003] : > > 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? OK. GtkContainer have a notion of 'internal' child. #children returns non-internal children. I would have thought that in GtkFrame the label was an internal child but the implementors apparently decided otherwise. The GTK documentation doesn't really specify this kind of things : on the GtkFrame page, they talk about methods introduced by GtkFrame, but they do not discuss how some methods are overridden. Looking at the GtkFrame source code, it appears that the child is returned first, then the label. So List.hd should do what you want (unless of course, you didn't add any widget). The cleanest solution would be to use the gtk_bin_get_child method that returns _the_ child of a GtkBin. Unfortunately this method isn't wrapped in LablGTK. Maybe we should add it. -- Olivier