Prevent firing OnClick event on TSpeedButton lazarus / 31-LCL ---------------------------------------------------------------------- rpetges · 2020-12-29 09:24 Hi, I have a TSpeedButton on my form to visually give a user feedback whenever the state changes. An attached OnClick event triggers actions whenever I click on the button. However, for a particular case, I need that the OnClick does NOT fire when I programmatically change the Down property of the TSpeedButton. In Delphi, I read that you can use for example TSpeedButton.ClicksDisabled but did not find a similar property in LCL. I could set the OnClick to NIL and restore it afterwards, but is there a more elegant solution ? Best regards, Romain ---------------------------------------------------------------------- Thaddy · 2020-12-29 09:38 TSpeedButton.Enabled := false. Then to restore TSpeedButton.Enabled := true. This approach has the added benefit that the user can see that the button is not available during processing. ---------------------------------------------------------------------- wp · 2020-12-29 09:43 I cannot reproduce this behaviour (Win 10, Laz 2.0.10/FPC 3.2.0, and Laz trunk/FPC3.2.0): the Speedbutton.OnClick fires only when I physically click on the button, when I toggle the Down state it does not fire. What are your Laz/FPC versions? Which OS/widgetset? ---------------------------------------------------------------------- Thaddy · 2020-12-29 09:56 I think that what he means that during the processing of the programmatic Down property the button should not fire events. This should be working with my suggestion. ---------------------------------------------------------------------- rpetges · 2020-12-29 10:50 The TSpeedButton.Enabled property did the trick  Many thanks to you all. ---------------------------------------------------------------------- jamie · 2020-12-29 12:44 I just tried that with and old 2.0.4,2.0.8, 10 and it does not fire the event when toggling the down property via code I haven't tried the trunk yet but I am sure it also works there , too.. P.s.   Just tried the trunk , it works there also..  I will say however I don't like the Themes drawing in windows, when button is in the down state its only a slight differences in shads of blue over here, kind of hard to discern the difference..  This is most likely why I implement the Paint handler for the speed buttons to give it a new bevel look and stay away from the themes drawing.