Link to home
Start Free TrialLog in
Avatar of fh2
fh2

asked on

Removing Focus

How can I remove focus from a button in Delphi 5?
Avatar of Evarest
Evarest

Bit stupid solution, but it works :-)

Place a button somewhere on your form where it can't be seen:

FocusButton1.Left :=-1000;
FocusButton1.Top :=-1000;

And if you want to loose the focus of any button call:
FocusButton1.SetFocus

This will focus the FocusButton1 (as it's still visible, you won't get an error)...

Good luck!
Evarest
Avatar of Amir Azhdari
and also try to find the tabstop property of the button in the object inspector and set that to false
I mean
button1.tabstop:=false;
use the following:

  Windows.SetFocus(0);

It removes the focus from the control but does not set the focus to any other control in the window.

Regards
Pierre
Or use TSpeedButton: it never get the Focus ;-))
ASKER CERTIFIED SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial