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-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed2-a.proxad.net!nnrp1-2.free.fr!not-for-mail Subject: Re: GtkAda callback and event Newsgroups: comp.lang.ada References: <6133e791$0$6461$426a74cc@news.free.fr> <6134cb26$0$3697$426a74cc@news.free.fr> <6134db32$0$6461$426a74cc@news.free.fr> <6134dc71$0$3693$426a74cc@news.free.fr> <6134e03d$0$3372$426a74cc@news.free.fr> <61352d42$0$3749$426a74cc@news.free.fr> <944e2cf6-2e24-480e-b7f7-0e0e0f5082e7n@googlegroups.com> From: DrPi <314@drpi.fr> Date: Thu, 9 Sep 2021 09:57:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <944e2cf6-2e24-480e-b7f7-0e0e0f5082e7n@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Message-ID: <6139be6f$0$12704$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 09 Sep 2021 09:57:35 CEST NNTP-Posting-Host: 82.65.30.55 X-Trace: 1631174255 news-2.free.fr 12704 82.65.30.55:63622 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:62679 List-Id: Le 09/09/2021 à 08:56, Emmanuel Briot a écrit : > You could perhaps consider using some of the higher-level event handling functions that > are generated as part of the binding. For instance, `gtk-widget.ads` has: > > ``` > type Cb_Gtk_Widget_Gdk_Event_Motion_Boolean is not null access function > (Self : access Gtk_Widget_Record'Class; > Event : Gdk.Event.Gdk_Event_Motion) return Boolean; > > type Cb_GObject_Gdk_Event_Motion_Boolean is not null access function > (Self : access Glib.Object.GObject_Record'Class; > Event : Gdk.Event.Gdk_Event_Motion) return Boolean; > > Signal_Motion_Notify_Event : constant Glib.Signal_Name := "motion-notify-event"; > procedure On_Motion_Notify_Event > (Self : not null access Gtk_Widget_Record; > Call : Cb_Gtk_Widget_Gdk_Event_Motion_Boolean; > After : Boolean := False); > procedure On_Motion_Notify_Event > (Self : not null access Gtk_Widget_Record; > Call : Cb_GObject_Gdk_Event_Motion_Boolean; > Slot : not null access Glib.Object.GObject_Record'Class; > After : Boolean := False); > ``` > > This ensures the proper list of parameters for the callback, and automatically gets you > the Event, for instance. > The problem with these functions is that you can't pass a user record to the callback.