Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursor position 1

Status
Not open for further replies.

Kenbla

Programmer
Oct 11, 2006
68
SE
Hello, I have a questions for you. I need to know the position of the cursor in TMemo object.
The users can enter information in the TMemo object and when they push a button on the form I need to know what the current position is in that field.
Is this an easy task or? We use Delphi XE.
Regards,
Kenbla
 
Reading TMemo.SelStart will get the current position of the cursor in terms of the number of characters that are in the TMemo.

Code:
procedure TForm1.Memo1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  Form1.Caption := 'Form1 : ' + IntToStr(Memo1.SelStart);
end;

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Thanks Glenn9999, that works just fine!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top