...den Cursor an eine bestimmte Position in einem TRichEdit bringen?

Autor: Babak Sateli
Homepage: http://www.cdcenterco.com

Kategorie: VCL

// You can move the caret in a TRichEdit component by using this code :

procedure RichEdit_MoveTo(RichEdit: TRichEdit; LineNumber, CharNumber: Word);
begin
  
RichEdit.SelStart := RichEdit.Perform(EM_LINEINDEX, LineNumber, 0) + CharNumber);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  
RichEdit_MoveTo(RichEdit1,2,5);
  Application.ProcessMessages;
  RichEdit1.SetFocus;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base