comp.lang.ada
 help / color / mirror / Atom feed
From: Alain De Vos <devosalain71@gmail.com>
Subject: gtkada3 callback function & failure : subprogram must not be deeper than access type
Date: Fri, 1 Nov 2019 11:30:49 -0700 (PDT)
Date: 2019-11-01T11:30:49-07:00	[thread overview]
Message-ID: <eaff9b38-2379-476b-ac3e-67e756b10dbf@googlegroups.com> (raw)

For callback functions there are 3 methods and one with data.
For the first method I try a program with one button
Connecting the button with the handler fails with the error :
>>>>subprogram must not be deeper than access type

The code :
-- TEST : Connecting via the On_* procedures first method
with Ada.Text_IO; use Ada.Text_IO;
with Glib;         use Glib;
with Glib.Object;  use Glib.Object;
with Gtk;          use Gtk;
with Gtk.Box;      use Gtk.Box;
with Gtk.Button;   use Gtk.Button;
with Gtk.Enums;    use Gtk.Enums;
with Gdk.Event;    use Gdk.Event;
with Gtk.Frame;    use Gtk.Frame;
with Gtk.Grid;     use Gtk.Grid;
with Gtk.Handlers; use Gtk.Handlers;
with Gtk.Label;    use Gtk.Label;
with Gtk.Main;     use Gtk.Main;
with Gtk.Widget;   use Gtk.Widget;
with Gtk.Window;   use Gtk.Window;
with Gtk.Main;   use Gtk.Main;

procedure hello_gtk is
   Main_Window : Gtk.Window.Gtk_Window;
   Button  : Gtk_Button;
   procedure On_Button_Click (Button : access Gtk_Button_Record'Class)
   is
   begin
      Put_line ("Hallo");
   end On_Button_Click;

   procedure Create_Window is
   begin
      Gtk.Window.Gtk_New
        (Window   => Main_Window,
         The_Type => Gtk.Enums.Window_Toplevel);
      Gtk.Window.Set_Title (Window => Main_Window, Title  => "Hello from ADA");
      --  Button.On_Clicked (On_Button_Click'Access); fails with subprogram must not be deeper than access type
      Add (Main_Window,Button);
      Gtk.Window.Show_All (Main_Window);
   end Create_Window;
begin
   Gtk.Main.Init;
   Create_Window;
   Gtk.Main.Main;
end hello_gtk;


             reply	other threads:[~2019-11-01 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 18:30 Alain De Vos [this message]
2019-11-01 18:47 ` gtkada3 callback function & failure : subprogram must not be deeper than access type Shark8
2019-11-01 18:57 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox