Re: Delphi FindDialog with a RichEdit

Posted by Maxwell on June 21, 2005

In Reply to: Re: Delphi FindDialog with a RichEdit posted by David Roseender on June 21, 2005

: How do you get the richedit to scroll to the matching text when that line is not currently displayed.
 

To scroll a RichEdit to the place where the cursor is, you use:

  RichEdit1.Perform(EM_SCROLLCARET, 0, 0);

By the way, the caret is at position RichEdit1.SelStart. So if you want to scroll to a certain position, first set SelStart and next use the code above. For example, scroll to the first line:

  RichEdit1.SelStart := 0;
  RichEdit1.Perform(EM_SCROLLCARET, 0, 0);


Delphi Forum