views:

234

answers:

2

Is there anyway to force a TSpeedButton to be redrawn flat?

When using a touch screen monitor, the mouse does not move out of the button, so the raised border stays on screen, even when you click on a different button.

+2  A: 

Did you try setting Flat property to True?

gabr
The button did not change. I think it may have something to do with the MouseInControl property.
stukelly
Too bad. Was worth trying, though.
gabr
+3  A: 

It doesn't look like this is something I can reproduce without a touch screen, but if I understand you correctly, when someone touches a button then it goes hot (either rising up if Down is true, or highlighting), but when they touch another button it doesn't trigger the mouse exit so it stays hot. Is that correct?

There are a couple ways to fix this. Probably the simplest is on each click event make a call top a method that moves the mouse off off the button.

Mouse.CursorPos := Point(0,0);

If that is not enough then you can disable the button that was clicked on, move the mouse off, refresh it, and re-enable it. A disabled button cannot be hot. You might want a timer that enables the button after it was disabled for a second with the mouse moved off of it, but I am betting that just moving the mouse will be enough.

Additionally I always thought it was cheese when a mouse cursor was left on the button that I just touched, so this will make your touch system look classier.

Jim McKeeth
Thanks Jim, this works great. I'll probably need an option to turn it off, it is weird when using a real mouse.
stukelly
You are correct, when you touch another button the mouse exit does not trigger.
stukelly
That sounds like a bug in the VCL then, as it is supposed to be firing OnExit when it detects the mouse has moved to another control for any reason. Which version of Delphi/BCB are you using?
Remy Lebeau - TeamB