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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:36d1:: with SMTP id b17mr760351qtc.202.1572633050320; Fri, 01 Nov 2019 11:30:50 -0700 (PDT) X-Received: by 2002:a9d:baf:: with SMTP id 44mr9405672oth.182.1572633050040; Fri, 01 Nov 2019 11:30:50 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!j16no541713qtl.0!news-out.google.com!g53ni234qtg.0!nntp.google.com!j16no541710qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 1 Nov 2019 11:30:49 -0700 (PDT) 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 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: gtkada3 callback function & failure : subprogram must not be deeper than access type From: Alain De Vos Injection-Date: Fri, 01 Nov 2019 18:30:50 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2858 X-Received-Body-CRC: 1406981642 Xref: reader01.eternal-september.org comp.lang.ada:57426 Date: 2019-11-01T11:30:49-07:00 List-Id: 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;