Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
Thread Tools Display Modes
Old 05-28-2019, 03:58 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
Join Date: Jul 2009
Posts: 362
Default onclick button stay down or up

using speed buttons and wanting to be able to click the button and it stay down. if i click it again i want it to stay up. multiple speed buttons

i cant remember the logic for flipping the button up/down each time it is clicked.
Old 05-28-2019, 04:41 PM
rojam rojam is offline
Senior Member
Join Date: Jun 2015
Posts: 200

if you want a group of buttons to work in concert then lookup the speedbutton's GroupIndex property, if you simply want a button to toggle down or up every time the user clicks it, then just toggle the speedbutton's down property in its OnClick handler.
procedure TFomr1.SpeedButtonClick(Sender: TObject);
  (Sender as TSpeedButton).Down := Not ((Sender as TSpeedButton).Down);
with casting Sender as TSpeedButton, you can use this same method for all speedbutton's that you would like to toggle.

***This code with only work if Sender is a TSpeedButton, else it is likely to crash.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 06:33 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.