* gtkada Connecting via the Gtk.Handlers object_connect problem
@ 2019-11-03 11:37 Alain De Vos
2019-11-03 13:03 ` Dmitry A. Kazakov
2019-11-04 23:44 ` Alain De Vos
0 siblings, 2 replies; 7+ messages in thread
From: Alain De Vos @ 2019-11-03 11:37 UTC (permalink / raw)
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
end myvboxpak;
---------------------------------
A file myvboxpak ->
package body myvboxpak is
procedure MyButtonClick (User_Data => T : MyVBoxR'Class) is
begin
.....
------------------------------------
A file hello.adb ->
procedure hello is
Top : Gtk.Window.Gtk_Window;
MyVBox : MyVBoxT;
procedure Create_Window is
begin
Gtk.Window.Gtk_New
(Window => Top,
The_Type => Gtk.Enums.Window_Toplevel);
Gtk.Window.Set_Title (Window => Top, Title => "Hello from ADA");
MyVBox := new MyVBoxR;
Initialize_Vbox (MyVBox);
Gtk_New (MyVBox.Button);
MyVBox.Add (MyVBox.Button);
Gtk_New (MyVBox.Label);
MyVBox.Add (MyVBox.Label);
Add (Top,MyVBox);
MYCB.Object_Connect
(Widget => MYVBOX.Button,
Name => "clicked",
Marsh => MYCB.To_Marshaller (MyButtonClick'Access), -- The signal handler
Slot_Object =>Top,
User_Data => MYVBOX
);
...
The error received while compiling is :
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
Or , "MYCB.To_Marshaller (MyButtonClick'Access)" , does not have the correct type, the functions expects a "Handler".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 11:37 gtkada Connecting via the Gtk.Handlers object_connect problem Alain De Vos
@ 2019-11-03 13:03 ` Dmitry A. Kazakov
2019-11-03 13:26 ` Alain De Vos
2019-11-04 23:44 ` Alain De Vos
1 sibling, 1 reply; 7+ messages in thread
From: Dmitry A. Kazakov @ 2019-11-03 13:03 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 13:03 ` Dmitry A. Kazakov
@ 2019-11-03 13:26 ` Alain De Vos
2019-11-03 15:23 ` Alain De Vos
0 siblings, 1 reply; 7+ messages in thread
From: Alain De Vos @ 2019-11-03 13:26 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 13:26 ` Alain De Vos
@ 2019-11-03 15:23 ` Alain De Vos
2019-11-03 15:24 ` Alain De Vos
0 siblings, 1 reply; 7+ messages in thread
From: Alain De Vos @ 2019-11-03 15:23 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 15:23 ` Alain De Vos
@ 2019-11-03 15:24 ` Alain De Vos
2019-11-03 21:46 ` Alain De Vos
0 siblings, 1 reply; 7+ messages in thread
From: Alain De Vos @ 2019-11-03 15:24 UTC (permalink / raw)
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);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 15:24 ` Alain De Vos
@ 2019-11-03 21:46 ` Alain De Vos
0 siblings, 0 replies; 7+ messages in thread
From: Alain De Vos @ 2019-11-03 21:46 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gtkada Connecting via the Gtk.Handlers object_connect problem
2019-11-03 11:37 gtkada Connecting via the Gtk.Handlers object_connect problem Alain De Vos
2019-11-03 13:03 ` Dmitry A. Kazakov
@ 2019-11-04 23:44 ` Alain De Vos
1 sibling, 0 replies; 7+ messages in thread
From: Alain De Vos @ 2019-11-04 23:44 UTC (permalink / raw)
On Sunday, November 3, 2019 at 12:37:46 PM UTC+1, 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
> end myvboxpak;
> ---------------------------------
> A file myvboxpak ->
> package body myvboxpak is
> procedure MyButtonClick (User_Data => T : MyVBoxR'Class) is
> begin
> .....
> ------------------------------------
> A file hello.adb ->
> procedure hello is
> Top : Gtk.Window.Gtk_Window;
> MyVBox : MyVBoxT;
>
> procedure Create_Window is
> begin
> Gtk.Window.Gtk_New
> (Window => Top,
> The_Type => Gtk.Enums.Window_Toplevel);
> Gtk.Window.Set_Title (Window => Top, Title => "Hello from ADA");
>
> MyVBox := new MyVBoxR;
> Initialize_Vbox (MyVBox);
> Gtk_New (MyVBox.Button);
> MyVBox.Add (MyVBox.Button);
> Gtk_New (MyVBox.Label);
> MyVBox.Add (MyVBox.Label);
>
> Add (Top,MyVBox);
> MYCB.Object_Connect
> (Widget => MYVBOX.Button,
> Name => "clicked",
> Marsh => MYCB.To_Marshaller (MyButtonClick'Access), -- The signal handler
> Slot_Object =>Top,
> User_Data => MYVBOX
> );
> ...
>
> The error received while compiling is :
> 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
>
> Or , "MYCB.To_Marshaller (MyButtonClick'Access)" , does not have the correct type, the functions expects a "Handler".
Or should I do something like,
package Button_Handler is new Handlers.Callback (Gtk_Button_Record); ?
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-04 23:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-03 11:37 gtkada Connecting via the Gtk.Handlers object_connect problem Alain De Vos
2019-11-03 13:03 ` Dmitry A. Kazakov
2019-11-03 13:26 ` Alain De Vos
2019-11-03 15:23 ` Alain De Vos
2019-11-03 15:24 ` Alain De Vos
2019-11-03 21:46 ` Alain De Vos
2019-11-04 23:44 ` Alain De Vos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox