[Gtk-sharp-list] [Semi-OT] Retrieving the lone child of a container

John Luke jluke@users.sourceforge.net
Sun, 02 Nov 2003 13:00:22 -0500


On Sat, 2003-11-01 at 19:19, Leo Spalteholz wrote:
> Sorry I don't know if this is gtk-sharp specific but its been bugging me 
> for a while...
> For a Gtk.Button (or any container designed for only one child for that 
> matter), is there an easy way to retrieve the child widget?  
> The only thing I've been able to come up with is:
> 
> Widget blah = null;
> foreach(Widget child in mybutton.Children)
> 	blah = child;
> 
> But it seems.. umm..  less than ideal to put it nicely.  There must be a 
> better way. :)
> 
Since Gtk# 0.12, there should now be a Child property that gets the
child of Widgets that derive from Gtk.Bin.  It wasn't being generated
earlier.