[gtkada] Handle signals inside a tagged record

Preben Randhol randhol at pvv.org
Mon Feb 17 10:18:25 CET 2003


Martin Klaiber <martinkl at zedat.fu-berlin.de> wrote on 17/02/2003 (09:53) :
> Preben Randhol <randhol at pvv.org> wrote:
> 
> > Why can't you simply do: 
> 
> >    Handlers.Connect (Ok_Button, "clicked", 
> >       Handlers.To_Marshaller (Update'Access));
> 
> I get the error-message:
> 
>   [...]: no candidate interpretations match the actuals:
>   [...]: expected type "Handler" defined at gtk-marshallers.ads:335,
>          instance at gtk-handlers.ads:524, instance at line 32
>   [...]: found type access to "Update" defined at line 196
>   
> I compile with -gnataEfo. Without, the error-message does not appear.
> Handlers is defined as:
> 
>   package Handlers is 
>     new Gtk.Handlers.Callback (Widget_Type => Gtk_Widget_Record);

This is because it expects a Gtk_Widget_Record and not a
Gtk_Button_Record

This should work:

   package Button_Callback is new
         Gtk.Handlers.Callback (Gtk_Button_Record);

    Button_Callback.Connect (Ok_Button, "clicked",·
      Button_Callback.To_Marshaller (Update'Access));

-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»



More information about the gtkada mailing list