How do I set a TSpeedButton (on a TToolbar) to look pressed down? It's only highlighted when clicking but gets normal when the mouse leaves it. I set the property Stayspressed to True and indeed the property IsPressed becomes and stays True, but this state is not visible.
2 Answers
What style are you using? Some of the included ones do not have every effect included.
First, revert back to the windows style. If that works, then it's definitely a styling issue, rather than a code issue.
If you want to add an effect (actually an animation) to another style:
- Right click on a button and select Edit Default Style.
- Find the Fill.Color property of the Rectangle you want to show the anmimation.
- Click the animation icon and add a TColorAnimation
- Set: the StartValue (the existing value).
- The StopValue
The Trigger: IsPressed=True
Repeat the above to add a second animation with the Start and StopValues reversed and Trigger of IsPressed=False

- 4,191
- 4
- 29
- 42
-
I checked the default stylebook for TSpeedButton. It is there, but it's buggy. There are two triggers fighting each other and the one for IsPressed always looses. – Steffen Binas Jun 03 '12 at 17:53
-
If you don't want to say which style you're using that's okay, but without that info it's not easy to help. – Mike Sutton Jun 03 '12 at 21:43
-
It's the "Windows Style"...the default one. I didn't set any style explicitly. – Steffen Binas Jun 24 '12 at 19:17
This is a tough one - the standard TButton style includes effects which work - the button will look pressed when "IsPressed" is true. However, other styles (and especially your own) can be much more problematic. I have found the best solution is to have 2 styles and change the style when the button is pressed.
I found it pretty impossible to get "mouseover" animation to work with "pressed" animation in buttons - normally you want to highlight the button slightly when the mouse passes over and then add an effect when you press - especially when you don't want the default shadow effect but a colour effect (which I prefer, I don't like the inner shadow effect of a default button press), but I always seemed to end up with issues. Either one effect wouldn't fire OR the button state wouldn't return to what you'd expect (visually I mean).
My advice - add a little bit of extra code to change the style for the pressed button, you might go mad otherwise :-)

- 85
- 1