Solved

Removing Focus

Posted on 2004-10-06
5
1,615 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now