2
I am wanting to position the text cursor in a certain position, in a normal situation would just click on the position only that I do not know what happened is not working. Reading the command on docwiki says that:
Indicates cursor position in memo client area.
Use Caretpos to determine the cursor coordinates. Caretpos defines a place on the screen, in characters, with the origin in the upper corner left of memo. X specifies the horizontal point coordinate, Y specifies the vertical coordinate.
To determine the position of the circumflex in terms of characters of text only (instead of X / Y location), use the property Selstart.
But not give an example of how I can use.
I have tried so no longer know how to get position X and nor Y...
procedure TfrmConsultas.Memo01OnClick(Sender: TObject);
begin
if Sender is TMemo then
begin
TMemo(Sender).CaretPos := x;
TMemo(Sender).CaretPos := Y;
TMemo(Sender).SetFocus;
end;
if Sender is TDBMemo then
begin
TDBMemo(Sender).CaretPos := x;
TDBMemo(Sender).CaretPos := Y;
TDBMemo(Sender).SetFocus;
end;
end;
Caretpos is not a Tpoint? Try: Tmemo(Sender). Caretpos := Point(x, y);
– Ricardo Alves Carvalho