[Gtk-sharp-list] Loop through all components in Window

smso at graduate.hku.hk smso at graduate.hku.hk
Sat Aug 25 15:17:26 EDT 2007


You may need a recursive function which acts on Gtk.Container, e.g.

public void parse_widget_tree(Gtk.Container parent)
{
	foreach (Gtk.Widget child in parent.AllChildren)
	{
		if (child is Gtk.Container)
		{
			Gtk.Container container = child as Gtk.Container;
			parse_widget_tree(container);
		}
		else if (child is Gtk.Label)
		{
			System.Console.WriteLine(child.Name);
		}
	}
}

[Glade.Widget] Gtk.Window window;
...
parse_widget_tree(window);




More information about the Gtk-sharp-list mailing list