[gtkada] Handle signals inside a tagged record

Preben Randhol randhol at pvv.org
Mon Feb 17 17:01:01 CET 2003


Martin Klaiber <martinkl at zedat.fu-berlin.de> wrote on 17/02/2003 (16:46) :
>                                              |
> The error appears here. ---------------------'
> 
> I've read the documentation up and down. Also the signaling-part in
> the Gtk-doc. I thought I understood what to do, but everything I try
> doesn't work. So probably I misunderstood it.

The error is because your Update is not correct. You are passing a
Gtk_Button_Record object while the Update expects a
Example_Record. You cannot do that. Like giving a banana tosomebody who
wants and orange :-)

So you must do something like this:

   package Example_Handler is new
      Gtk.Handlers.User_Callback (Gtk_Button_Record,
                                  Examine_Record);

with Update as:

   procedure Update
      (Button  : access Gtk_Radio_Button_Record'Class;
       Example : access Example_Record'Class);

The callback is then:


   Example_Handler.Connect
      (Button, "clicked",
       Example_Handler.To_Marshaller (Update'Access),
       Your_Example_Object);

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



More information about the gtkada mailing list