comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GtkAda callback and event
Date: Fri, 10 Sep 2021 08:38:02 +0200	[thread overview]
Message-ID: <sheugb$lop$1@gioia.aioe.org> (raw)
In-Reply-To: f4291006-ea19-4896-b7bc-96ce3c102955n@googlegroups.com

On 2021-09-09 23:01, Jere wrote:

> Okie dokie!  After reading this chain I took a look at the GtkAda manual and
> saw that they had separate high level events for things like button clicks and
> such and that they used access to 'Class types so I was hoping that meant
> for the OP that they could, for example do something like:
> 
> type My_Button is new Gtk.Whatever_Path.Button_Type with record
>     User_Data : User_Data_Type;
> end record;

    type My_Button is new Get_Button_Record with record
       User_Data : User_Data_Type;
    end record;

> procedure On_Button_Click(Self : access to Button_Type'Class) is
>     A_Button : My_Button renames My_Button(Self.all);  -- forget if this is allowed or not
> begin
>     -- use A_Button.User_Data.???
> end On_Button_Click;
> 
> and attach that as the handler.  But based on what you said it sounds like this is not
> actually an option.  (And of course the OP isn't using buttons, but just an example).

This works perfectly well in GtkAda. Unfortunately is not what is needed 
in most cases.

User data is a property of the event not of the button. E.g. consider a 
button to save file. The user data would be some Ada object responsible 
for dealing with the file. What about other buttons? What about 
life-times of buttons? User data usually have a longer life span etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-09-10  6:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 21:39 GtkAda callback and event DrPi
2021-09-04 22:29 ` Dmitry A. Kazakov
2021-09-05 13:50   ` DrPi
2021-09-05 14:48     ` Dmitry A. Kazakov
2021-09-05 14:58       ` DrPi
2021-09-05 15:04         ` DrPi
2021-09-05 15:12           ` Dmitry A. Kazakov
2021-09-05 15:20             ` DrPi
2021-09-05 15:53               ` Dmitry A. Kazakov
2021-09-05 20:49                 ` DrPi
2021-09-09  6:56                   ` Emmanuel Briot
2021-09-09  7:57                     ` DrPi
2021-09-09 18:41                       ` Jere
2021-09-09 19:58                         ` Dmitry A. Kazakov
2021-09-09 21:01                           ` Jere
2021-09-10  6:38                             ` Dmitry A. Kazakov [this message]
2021-09-10  6:56                               ` Emmanuel Briot
2021-09-10 20:42                                 ` DrPi
2021-09-10 20:58                                   ` Dmitry A. Kazakov
2021-09-11  7:38                                     ` Emmanuel Briot
2021-09-11 15:24                                     ` DrPi
2021-09-11 15:56                                       ` Dmitry A. Kazakov
2021-09-12  7:08                                       ` AdaMagica
2021-09-12  8:52                                         ` Dmitry A. Kazakov
2021-09-12 13:00                                           ` DrPi
2021-09-12 13:57                                             ` Dmitry A. Kazakov
2021-09-10 20:46                                 ` Dmitry A. Kazakov
2021-09-11  7:36                                   ` Emmanuel Briot
replies disabled

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