On 03/29/2017 07:08 PM, Gautier de Montmollin wrote:
> Various mouse events are working well when handler is set on a Canvas.
> Now I'd like to have a button (purely graphical) with a captive On_Click 
> handler.
> If I (mis-)use a sprite for that, the setting of the handler is accepted at 
> compilation
>
>     App.Sound_switch.On_Click_Handler 
> (On_sound_switch_click'Unrestricted_Access);
>
> but seems ineffective. Probably I'm doing a Bad Thing.
> Would another kind of graphical object be better for the job, or is it more 
> advisable to capture clicks on the whole canvas and locate eventual clicks in 
> the button area (easy, but less elegant) ?

I don't know if this helps, but if we follow the derivations back:

   type Button_Type is new Gnoga.Gui.View.View_Base_Type with private;
   ...
   type View_Base_Type is new Gnoga.Gui.Element.Element_Type with private;
   ...
   type Element_Type is new Gnoga.Gui.Base.Base_Type with private;
   ...
   procedure Background_Image (Element : in out Element_Type;
                               Value   : in     String);
   function Background_Image (Element : Element_Type) return String;
   --  proper syntax is "url(...)" | "" to clear

So presumably you can have a button with an image instead of text.

-- 
Jeff Carter
"I fart in your general direction."
Monty Python & the Holy Grail
05


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to