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=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:5802:: with SMTP id g2mr4237112qtg.391.1631212911421; Thu, 09 Sep 2021 11:41:51 -0700 (PDT) X-Received: by 2002:a05:6902:1549:: with SMTP id r9mr5781600ybu.204.1631212911229; Thu, 09 Sep 2021 11:41:51 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 9 Sep 2021 11:41:50 -0700 (PDT) In-Reply-To: <6139be6f$0$12704$426a74cc@news.free.fr> Injection-Info: google-groups.googlegroups.com; posting-host=98.118.241.166; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 98.118.241.166 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> <6139be6f$0$12704$426a74cc@news.free.fr> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <757da468-7b58-43c2-95e6-917b3212f7b2n@googlegroups.com> Subject: Re: GtkAda callback and event From: Jere Injection-Date: Thu, 09 Sep 2021 18:41:51 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:62682 List-Id: On Thursday, September 9, 2021 at 3:57:37 AM UTC-4, DrPi wrote: > Le 09/09/2021 =C3=A0 08:56, Emmanuel Briot a =C3=A9crit :=20 > > You could perhaps consider using some of the higher-level event handlin= g functions that=20 > > are generated as part of the binding. For instance, `gtk-widget.ads` ha= s:=20 > >=20 > > ```=20 > > > > ```=20 > >=20 > > This ensures the proper list of parameters for the callback, and automa= tically gets you=20 > > the Event, for instance.=20 > > > The problem with these functions is that you can't pass a user record to= =20 > the callback. I'm not as versed in GtkAda, but it looks like those have 'Class types so i= f it is like most of the other GUI frameworks out there, you typically would extend the type that you are doing the handler for and your user data would be fields of the new record type. Since the handler uses 'Class you could = just=20 cast the parameter to your new type and have access to the user data. Otherwise I'm not sure what you mean. The GUI work loop doesn't generally= =20 pass user data to a callback, just the event and the listener to the event.= All user data in most GUI frameworks is handled on the listener side, which is why a lot of them rely on type extension of the listener type.