From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:528a:: with SMTP id s10mr9661942qtn.361.1572817617460; Sun, 03 Nov 2019 13:46:57 -0800 (PST) X-Received: by 2002:a54:4e94:: with SMTP id c20mr7580561oiy.157.1572817617140; Sun, 03 Nov 2019 13:46:57 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.unit0.net!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!j16no7678550qtl.0!news-out.google.com!g53ni514qtg.0!nntp.google.com!j16no7678548qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Nov 2019 13:46:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:a03f:e3e9:4d00:1260:4bff:fe89:deb2; posting-account=kTRirAoAAACnF_wtAOSamxYBSVvmJuCa NNTP-Posting-Host: 2a02:a03f:e3e9:4d00:1260:4bff:fe89:deb2 References: <254277d5-2ccc-474c-a65d-c5e2def102bd@googlegroups.com> <0fc7ca20-5641-46e1-9559-970f03267afb@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: gtkada Connecting via the Gtk.Handlers object_connect problem From: Alain De Vos Injection-Date: Sun, 03 Nov 2019 21:46:57 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57460 Date: 2019-11-03T13:46:56-08:00 List-Id: On Sunday, November 3, 2019 at 4:24:15 PM UTC+1, Alain De Vos wrote: > On Sunday, November 3, 2019 at 4:23:12 PM UTC+1, Alain De Vos wrote: > > On Sunday, November 3, 2019 at 2:26:37 PM UTC+1, Alain De Vos wrote: > > > On Sunday, November 3, 2019 at 2:03:55 PM UTC+1, Dmitry A. Kazakov wrote: > > > > On 2019-11-03 12:37, Alain De Vos wrote: > > > > > I try an application with one button and one label and one handler > > > > > > > > > > http://docs.adacore.com/live/wave/gtkada/html/gtkada_ug/signals.html#second-case-using-object-connect-instead > > > > > ------------------------- > > > > > I have a file myvboxpak.ads -> > > > > > package myvboxpak is > > > > > > > > > > type MyVBoxR is new Gtk_VBox_Record with record > > > > > Button : Gtk_Button; > > > > > Label : Gtk_Label; > > > > > end record; > > > > > type MyVBoxT is access all MyVBoxR'Class; > > > > > > > > > > package MYCB is new Gtk.Handlers.User_Callback(Glib.Object.GObject_Record,MyVBoxT); > > > > > > > > > > procedure MyButtonClick (T : MyVBoxR'Class); --eventhandler ^^^^^^^^^^^^^^^^^^^ > > > > Should have been T : access MyVBoxR'Class > > > > > > > > -- > > > > Regards, > > > > Dmitry A. Kazakov > > > > http://www.dmitry-kazakov.de > > > > > > I changed the handler to : > > > package body myvboxpak is > > > procedure MyButtonClick (T : access MyVBoxR'Class) is > > > begin > > > begin > > > T.Button.Set_Label ("You pressed"); > > > ... > > > > > > Compile error of the connect_object function is still : > > > MYCB.Object_Connect > > > (Widget => MYVBOX.Button, > > > Name => "clicked", > > > Marsh => MYCB.To_Marshaller (MyButtonClick'Access), -- The signal handler > > > Slot_Object =>Top, > > > User_Data => MYVBOX > > > ); > > > Error : > > > Compile > > > [Ada] hello.adb > > > hello.adb:35:27: no candidate interpretations match the actuals: > > > hello.adb:35:56: expected type "Handler" defined at gtk-marshallers.ads:546, instance at gtk-handlers.ads:1164, instance at myvboxpak.ads:17 > > > hello.adb:35:56: found type access to procedure "MyButtonClick" defined at line 35 > > > hello.adb:35:56: ==> in call to "To_Marshaller" at gtk-handlers.ads:1205, instance at myvboxpak.ads:17 > > > > Some additional info : > > mymarsh : Gtk.Marshallers.General_Handler; > > > > mymarsh := MYCB.To_Marshaller (Cb => MyButtonClick'Access); > > > > Error : no candidate interpretations match the actuals expected type "Handler" > > > > package MYCB is new Gtk.Handlers.User_Callback(Glib.Object.GObject_Record,MyVBoxT); > > > > MYCB.Object_Connect > > (Widget => MYVBOX.Button, > > Name => "clicked", > > Marsh => mymarsh, > > Slot_Object =>Top, > > User_Data => MYVBOX, > > After => False > > ); > > > > Error : > > Marsh => mymarsh, > > Expected type marchaller. > > expected type "Handler" in mymarsh := MYCB.To_Marshaller (Cb => MyButtonClick'Access); I think I need a marshaller, a handler or a simple-handler. http://docs.adacore.com/gtkada-docs/gtkada_rm/gtkada_rm/docs/gtk__marshallers___user_void_marshallers___spec.html#L492C12 http://docs.adacore.com/gtkada-docs/gtkada_rm/gtkada_rm/docs/gtk__handlers___user_callback___spec.html#L1057C12 http://docs.adacore.com/gtkada-docs/gtkada_rm/gtkada_rm/docs/gtk__handlers___user_callback___spec.html#L1061C12