[gtkada] Event handler using Gtk.Widget

Dmitry A. Kazakov mailbox at dmitry-kazakov.de
Sun Jun 21 12:42:47 CEST 2009


On Sun, 21 Jun 2009 11:19:54 +0800, you wrote:

> I am building a composite wiget as a learning exercise. I declared callback
> handlers for each of the active widget types I am using :
>    package Window_Callback_Pkg is new
>       Gtk.Handlers.Callback (Gtk.Window.Gtk_Window_Record);
> 
>    package Image_Menu_Item_Callback_Pkg is new
>       Gtk.Handlers.Callback
> (Gtk.Image_Menu_Item.Gtk_Image_Menu_Item_Record);
> 
>    package Button_Callback_Pkg is new
>       Gtk.Handlers.Callback (Gtk.Button.Gtk_Button_Record);
> 
> Following communication with folks on the list it has occurred to me that I
> need not work so hard. I think I could simply write one instantiation :
>    package Widget_Callback_Pkg is new
>       Gtk.Handlers.Callback (Gtk.Widget.Gtk_Widget_Record);
> 
> which would cover all eventualities. Am I right about this?

Yes. Provided, you didn't need any members of the widget that aren't
present in the Gtk_Widget_Record.

BTW, an instance of Gtk.Handlers.Callback with Gtk_Widget_Record already
exists as Gtkada.Handlers.Widget_Callback, so you don't need to instantiate
that again.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



More information about the gtkada mailing list