Event handler using Gtk.Widget

View: New views
2 Messages — Rating Filter:   Alert me  

Event handler using Gtk.Widget

by Rick Duley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks

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?

Has at least one penny dropped?


--
Rick Duley
North Perth,
Western Australia                  
http://www.freewebs.com/rickduley/
                                    .-_|\
                                   /     \
                             perth *_.-._/
                                        v
aussie :    
  04... 
o'seas :   +61 ... 
--------------------------------------------
Committees:
"... dark alley down which ideas are led
                   ... then strangled."
                                  (PepsiCo)

_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: Event handler using Gtk.Widget

by Dmitry A. Kazakov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada