Solved

Setfocus back to previously disabled Edit

Posted on 1998-10-06
4
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 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