BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TEdit.SetFocus

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Alan
Guest





PostPosted: Wed Oct 29, 2003 3:52 am    Post subject: TEdit.SetFocus Reply with quote



I have a TEdit box on a form, and also a groupbox, at some time the focus is
on the group box and I want to set the focus at the edit box.
I tried SetFocus method of the edit box but the text was also highlighted, I
just want to put the cursor at the end of the text.


Back to top
Arno Verhoeven
Guest





PostPosted: Wed Oct 29, 2003 6:59 am    Post subject: Re: TEdit.SetFocus Reply with quote



Alan wrote:

Quote:
I have a TEdit box on a form, and also a groupbox, at some time the
focus is on the group box and I want to set the focus at the edit box.
I tried SetFocus method of the edit box but the text was also
highlighted, I just want to put the cursor at the end of the text.

MyEdit.SetFocus;
MyEdit.SelStart := length(MyEdit.Text);

HTH

Arno

Back to top
Kurt Barthelmess
Guest





PostPosted: Wed Oct 29, 2003 11:06 am    Post subject: Re: TEdit.SetFocus Reply with quote



"Alan" <NOSPAMalanpltse (AT) yahoo (DOT) com.au> wrote:

Quote:
I have a TEdit box on a form, and also a groupbox, at some time the focus is
on the group box and I want to set the focus at the edit box.
I tried SetFocus method of the edit box but the text was also highlighted, I
just want to put the cursor at the end of the text.

If you want it at the end, do as Amo suggested. If you want the caret
left as it was the last time the edit had the focus, set
Edit1.AutoSelect to False.

Good luck.

Kurt


Back to top
Alan
Guest





PostPosted: Fri Oct 31, 2003 3:38 am    Post subject: Re: TEdit.SetFocus Reply with quote

Yes, set AutoSelect := FALSE
Thanks

"Kurt Barthelmess (TeamB)" <kbarthelmess (AT) compuserve (DOT) com> wrote

Quote:
"Alan" <NOSPAMalanpltse (AT) yahoo (DOT) com.au> wrote:

I have a TEdit box on a form, and also a groupbox, at some time the focus
is
on the group box and I want to set the focus at the edit box.
I tried SetFocus method of the edit box but the text was also
highlighted, I
just want to put the cursor at the end of the text.

If you want it at the end, do as Amo suggested. If you want the caret
left as it was the last time the edit had the focus, set
Edit1.AutoSelect to False.

Good luck.

Kurt




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.