[gtkada] Canvas signal "item_select" - can't complile

Enno Bartels enno.bartels at m.eads.net
Tue Oct 22 09:24:40 CEST 2002


Hi

I am working with gtkada-canvas and if someone
clicks on an item I would like to get the number of 
the item. 
But it will not compile:

gnatmake runit `amdb-config` 
gnatgcc -c -I/usr/include/gtkada -I/usr/include/gtk-1.2/gdk 
-I/usr/local/lib/adasockets -g -gnatE -gnatf test_waypoint_dialog.adb
test_waypoint_dialog.adb:1233:35: no candidate interpretations match the 
actuals:
test_waypoint_dialog.adb:1233:61: expected type "Handler" defined at 
gtk-marshallers.ads:335, instance at gtk-handlers.ads:524, instance at line 
146
test_waypoint_dialog.adb:1233:61: found type access to "Item_Select" defined 
at line 1233
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:542, instance at line 146
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:539, instance at line 146
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:536, instance at line 146
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:533, instance at line 146
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:530, instance at line 146
test_waypoint_dialog.adb:1233:61:   ==> in call to "To_Marshaller" at 
gtk-handlers.ads:527, instance at line 146
gnatmake: "test_waypoint_dialog.adb" compilation error
make: *** [all] Error 4

I do not understand whats wrong because the other signals did work.!

It  works too, if I change 
    procedure Item_Select
     (Canvas : access Interactive_Canvas_Record'Class;
      Item   : Canvas_Item)
to
   procedure Item_Select
     (Canvas : access Interactive_Canvas_Record'Class)
but I need the Item! So what can I do ??


Here is my code:

   ----------------------------------------------------------------
   --  Redefine our own item type, since we want to provide our own
   --  graphics.
   ----------------------------------------------------------------
   type Display_Item_Record is new Canvas_Item_Record with record
      Color : Gdk.Color.Gdk_Color;
      W, H  : Gint;
      Num   : Positive;
      X, Y  : Gint;
      Mode  : Integer;
   end record;
   type Display_Item is access all Display_Item_Record'Class;

...................

package Canvas_Cb  is new Gtk.Handlers.Callback (Interactive_Canvas_Record);

...................

 ----------------------------------------------------------------------------
   -- procedure "Item_Select"
 ----------------------------------------------------------------------------
   procedure Item_Select
     (Canvas : access Interactive_Canvas_Record'Class;
      Item   : Canvas_Item)
   is
         It : Display_Item := Display_Item (Item);
   begin
     Text_Io.Put_Line ("item selected " & It.Num'Img);
   end Item_Select;

......................

Canvas        : Interactive_Canvas;
...
Canvas_Cb.Object_Connect (Canvas, "item_selected",
                   Canvas_Cb.To_Marshaller(Item_Select'Access), Canvas);



Thanks
Enno




More information about the gtkada mailing list