Solved

Setfocus back to previously disabled Edit

Posted on 1998-10-06
4
152 Views
Last Modified: 2010-04-06
On my form I have one TEdit which always has the focus with the flashing cursor inside it which clearly shows the user where the focus is.  At some point this edit is disabled for a few seconds than re-enabled. After re-enabling, the cursor no longer flashes inside the edit, even if I do a edit1.setfocus.  If there was text selected prior to the disabling, the text no longer shows as selected (although it is still in fact selected) when re-enabling.  Any suggestions on how to fix that.  I know tabbing to another field than back soves it but that I would prefer not to do that.
0
Comment
Question by:moonrise
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 40 total points
Comment Utility
Hello moonrise... Here is the answer to your question...

with DisabledEdit do begin
  SetFocus;
  SelStart := 1;
  SelLength := Length(Text);
end;

That's all I guess...

Regards,
Viktor Ivanov

0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Here is a simpler way...

DisabledEdit.SetFocus;
DisabledEdit.SelectAll;

Regards,
Viktor Ivanov
0
 

Author Comment

by:moonrise
Comment Utility
Have you tried it ? It does not seem to work for me.

Thank you.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
No I haven't ... I'll take a look at it in a second....
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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

18 Experts available now in Live!

Get 1:1 Help Now