comp.lang.ada
 help / color / mirror / Atom feed
From: tonyg <tonythegair@gmail.com>
Subject: Re: Gnoga - The GNU Omnificent GUI for Ada
Date: Fri, 3 Oct 2014 02:04:20 -0700 (PDT)
Date: 2014-10-03T02:04:20-07:00	[thread overview]
Message-ID: <3b458fe2-6455-4c09-a9c7-ec3616db1cbf@googlegroups.com> (raw)
In-Reply-To: <180c6d86-8d9c-456a-9f30-8f8a679d424c@googlegroups.com>

On Friday, 3 October 2014 03:28:49 UTC+1, David Botton  wrote:
> > If I create five buttons and attach the same on click handler, how do I identify the button clicked to the code inside the handler?
> 
> 
> 
> There are many ways to do it, here is a simple way (notice the use of dynamic controls, views will deallocate them when they are finalized). When you create each button, give it an ID. e.g.
> 
> 
> 
> declare
> 
>    My_Button : Button_Access;
> 
> begin
> 
>    My_Button := new Button_Type;
> 
>    My_Button.Create (My_View, "Click Me 1", ID="b1");
> 
>    My_Button.On_Click_Handler (My_Click'Access);
> 
> 
> 
>    My_Button := new Button_Type;
> 
>    My_Button.Create (My_View, "Click Me 2", ID="b2");
> 
>    My_Button.On_Click_Handler (My_Click'Access);
> 
> end;
> 
> 
> 
> procedure My_Click (Object : Base_Type'Class) is
> 
> begin
> 
>    if Object.ID = "b1" then
> 
>       Gnoga.Log ("Clicked Button 1");
> 
>    if Object.ID = "b2" then
> 
>       Gnoga.Log ("Click Button 2");
> 
>    end if;
> 
> end My_Click;

Thanks David, thats really helpful :)

  parent reply	other threads:[~2014-10-03  9:04 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 18:20 Gnoga - The GNU Omnificent GUI for Ada David Botton
2014-09-23 19:38 ` Anh Vo
2014-09-24  7:15 ` Thomas Løcke
2014-09-24  9:57 ` tonyg
2014-09-24 11:59   ` David Botton
2014-09-26 14:17     ` tonyg
2014-09-28  1:24       ` David Botton
2014-09-24 21:16 ` David Botton
2014-09-24 21:25   ` Jeffrey Carter
2014-09-24 21:36     ` David Botton
2014-09-25  4:26 ` Nasser M. Abbasi
2014-09-28  1:17   ` David Botton
2014-09-28  8:02   ` Niklas Holsti
2014-09-28  8:26     ` David Botton
2014-09-28  9:18       ` Niklas Holsti
2014-09-28  9:51         ` Niklas Holsti
2014-10-20 21:03         ` David Botton
2014-10-21 10:07           ` Brian Drummond
2014-09-28  9:06 ` David Botton
2014-09-29  2:42 ` David Botton
2014-09-30  3:31   ` David Botton
2014-09-30  9:39     ` tonyg
2014-09-30 16:24       ` David Botton
2014-10-01  1:04         ` Shark8
2014-10-01  0:22           ` David Botton
2014-10-01  3:24             ` Shark8
2014-10-01  2:55               ` David Botton
2014-10-01  9:48                 ` tonyg
2014-10-01 13:13                   ` David Botton
2014-10-01 13:47                   ` David Botton
2014-10-01 19:06                     ` David Botton
2014-10-01 10:25                 ` tonyg
2014-10-01 13:31                   ` David Botton
2014-10-01 15:11                     ` tonyg
2014-09-30  9:43     ` tonyg
2014-09-30 16:34       ` David Botton
2014-10-02  2:54 ` David Botton
2014-10-02  8:58   ` tonyg
2014-10-02 10:17   ` tonyg
2014-10-02 15:43     ` David Botton
2014-10-02 17:26       ` tonyg
2014-10-03  2:21         ` David Botton
     [not found]         ` <5ca5a27d-9338-4b20-97d9-62ce7c952898@googlegroups.com>
2014-10-03  2:28           ` David Botton
2014-10-03  3:34             ` David Botton
2014-10-03  5:17               ` Jeffrey Carter
2014-10-03 11:15                 ` David Botton
2014-10-03  9:04             ` tonyg [this message]
2014-10-03  2:30         ` David Botton
2014-10-03  2:50 ` David Botton
2014-10-03 11:21 ` David Botton
2014-10-03 11:36   ` Björn Lundin
2014-10-03 18:59     ` David Botton
2014-10-03 19:05 ` David Botton
2014-10-04  5:18   ` Shark8
2014-10-05  1:17     ` David Botton
2014-10-05 18:23 ` tonyg
2014-10-07  4:31 ` David Botton
2014-10-08  2:52 ` David Botton
replies disabled

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