Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Moving the cursor inside the Tedit

Halim1973Halim1973 Member Posts: 31
I have a field edit1.text with the value of : "books"
I want move to this field using the tab key but also I want the cursor to be at the end of the text of edit1 so I can start typing directly after "books" without hiting the key END.
Thank you.

Comments

  • zibadianzibadian Member Posts: 6,349
    : I have a field edit1.text with the value of : "books"
    : I want move to this field using the tab key but also I want the cursor to be at the end of the text of edit1 so I can start typing directly after "books" without hiting the key END.
    : Thank you.
    :
    Here is a small untested OnEnter event, which should place the text-cursor to the end of any word in the edit box:
    [code]
    procedure TForm1.Edit1Enter(Sender: TObject);
    begin
    Edit1.SelStart := Length(Edit1.Text);
    end;
    [/code]
    See the help files for more info on SelStart.
  • Halim1973Halim1973 Member Posts: 31
    : : I have a field edit1.text with the value of : "books"
    : : I want move to this field using the tab key but also I want the cursor to be at the end of the text of edit1 so I can start typing directly after "books" without hiting the key END.
    : : Thank you.
    : :
    : Here is a small untested OnEnter event, which should place the text-cursor to the end of any word in the edit box:
    : [code]
    : procedure TForm1.Edit1Enter(Sender: TObject);
    : begin
    : Edit1.SelStart := Length(Edit1.Text);
    : end;
    : [/code]
    : See the help files for more info on SelStart.
    :
    Works Great.
    thank you!
Sign In or Register to comment.