Solved

Setfocus back to previously disabled Edit

Posted on 1998-10-06
4
156 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
ID: 1342098
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
ID: 1342099
Here is a simpler way...

DisabledEdit.SetFocus;
DisabledEdit.SelectAll;

Regards,
Viktor Ivanov
0
 

Author Comment

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

Thank you.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1342101
No I haven't ... I'll take a look at it in a second....
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to add Windows metadata to a text file programmatically with Delphi? 3 170
automatically logging in via bde delphi 3 70
Delphi OLE Error 8 95
Run video youtube webbrowse 10 58
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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 demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

16 Experts available now in Live!

Get 1:1 Help Now