[gtkada] Newbie question: Glade-2 and child widget access

Leonardo Cecchi leonardoce at interfree.it
Fri Dec 31 09:47:09 CET 2004


Ok. I've done a straightforward translation to Ada of the C code and now all works!

function Get_Toplevel_En(Object : Gtk_Widget) return Gtk_Widget
is
	Widget : Gtk_Widget;
	Parent : Gtk_Widget;
begin
	Widget:=Object;
	loop
		if Widget.All in Gtk_Menu_Record'Class then
			Parent:=Get_Attach_Widget(Gtk_Menu(Widget));
		else
			Parent:=Get_Parent(Widget);
		end if;

		if Get_Parent(Parent)=null then
			return Parent;
		else
			Widget:=Parent;
		end if;
	end loop;
end;

Enhancements and corrections are welcome!
Thanks,

Leonardo



More information about the gtkada mailing list