From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Luke A. Guest" Newsgroups: comp.lang.ada Subject: Re: What does this error mean and how do I correct this? Date: Fri, 1 Sep 2023 22:41:54 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 1 Sep 2023 21:41:54 -0000 (UTC) Injection-Info: dont-email.me; posting-host="071b60dbcff7ef73c47f3433fa26b33f"; logging-data="40653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QOTTCFlhy+s4Tz8hpLgK+qPjXMkB9Was=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cancel-Lock: sha1:S0LfW0CrNEXI3wl1BFRVx00PG/o= In-Reply-To: Content-Language: en-GB Xref: news.eternal-september.org comp.lang.ada:65580 List-Id: Handler needs to be in a package you with. On 01/09/2023 22:04, richardthiebaud wrote: > in the following program: > > with Gtk.Enums; use Gtk.Enums; > with Gtk.Main; > with Gtk.Window; > with Gdk; > with Gdk.Event; > with Glib; > with Glib.Object; > > procedure test1 is >    Win       : Gtk.Window.Gtk_Window; >    function Handler >      (Self  : access Glib.Object.GObject_Record'Class; >       Event : Gdk.Event.Gdk_Event_Button) return Boolean is >    begin >       Gtk.Main.Main_Quit; >       return True; >    end Handler; >    -- >    --  defined in gtk-widget.ads >    -- >    --  type Cb_GObject_Gdk_Event_Button_Boolean is not null access > function >    --  (Self  : access Glib.Object.GObject_Record'Class; >    --   Event : Gdk.Event.Gdk_Event_Button) return Boolean; > > begin  -- Gtk.Init; >    Gtk.Main.Init; >    Gtk.Window.Gtk_New (Window => Win, The_Type => > Gtk.Enums.Window_Toplevel); >    Win.Set_Position (Win_Pos_Center); >    Gtk.Window.Set_Title (Window => Win, Title => "Editor"); >    Gtk.Window.Show_All (Win); >    Win.On_Button_Press_Event     <------------ line that gets the error >       (Call =>  Handler'Access, >        After => False, >        Slot =>  Win); >    Gtk.Main.Main; > end test1; > > I get the compiler error message: > > test1.adb:32:17: subprogram must not be deeper than access type > > What does this mean and how can I correct it?