Solved

Removing Focus

Posted on 2004-10-06
5
1,696 Views
Last Modified: 2012-05-05
How can I remove focus from a button in Delphi 5?
0
Comment
Question by:fh2
5 Comments
 
LVL 4

Expert Comment

by:Evarest
ID: 12242254
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
0
 
LVL 6

Expert Comment

by:Amir Azhdari
ID: 12242465
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;
0
 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 12242967
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
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12242997
Or use TSpeedButton: it never get the Focus ;-))
0
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 250 total points
ID: 12243949
or set the Focus in any other control (in the OnClick event of the button or whenever you want the focus to go away from the button)

Edit1.SetFocus;
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Path  to current project in Delphi. 2 80
how to center only a line in richedit? 4 57
control image tags in a string ? 12 131
Delphi...Split view - idea? 1 68
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question