[SOLVED] Problem with speedbutton down lazarus / 31-LCL ---------------------------------------------------------------------- madepabloh · 2012-10-12 10:33 Hi folks, After to chek my code, seach for information on this forum and in the web, i didn´t solved a problem i have with a speedbutton. I want to have the speedbutton remaining down afeter to receive other click. Then, i adjusted this options: QuoteAllowAllUP = TRUE GroupIndex=1 Down= False I included my code to execute when it is down in OnClick. It checks if the botton is down to execute a prodecure, and other different if it is up. This is the code i have on "OnClick": Code: [Select]procedure TForm1.SpeedButton1Click(Sender: TObject); begin      If SpeedButton1.Down = False then        Begin          Chart3LineSeries1.ShowPoints:=True;          SpeedButton1.Down := True;          SpeedButton1.Hint := 'Hide plot points';        end      else        begin          Chart3LineSeries1.ShowPoints:=False;          SpeedButton1.Down := False;          SpeedButton1.Hint := 'Show plot points';        end; end; The case is that when i do click, nothing happends, and the speedbutton does not remain down. But if i do double click, it execute the code correctly, and the speedbutton remain down... But it never return to be up (neither with one or two clicks...). Am i doing something wrong? Is it a bug? I am using Lazarus 1.0 since august 2012. Thanks! ---------------------------------------------------------------------- Ocye · 2012-10-12 11:21 Add a "New Checkbutton" to the toolbar (right click at the bar). By doing this you get a toolbutton with property Style=tbsCheck instead of tbsButton. Those buttons alternate down on/off on click, which can be set in advance too. Your code will run in OnClick depending on this property. BTW: IMHO it's error prone to set down property by code. That results in strange on/off effects. So I recommend to use build in features only. ---------------------------------------------------------------------- madepabloh · 2012-10-12 11:32 Thanks @Ocye, it works perfect now. Just only, the new button is not visible after it is marked... The color of the toolbar in which it is located is white, so may be there is the problem. Thanks for the fast solution! ---------------------------------------------------------------------- Ocye · 2012-10-12 20:37 What do you mean with "not visible"? A flat toolbar button has no special appearance. Assign an icon to it (use imagelist, or even better apply an action that uses an imagelist) or set flat to false. ---------------------------------------------------------------------- madepabloh · 2012-10-12 21:56 You are right, my fault. I didn´t see the "flat" option so it was so extrange for me. But now i see that it is flat by default. So everything is ok. Thanks again @Ocye