Board index » delphi » RichEdit and Reset First Visible Line

RichEdit and Reset First Visible Line

Quite a few threads here deal with how to goto a line in a RichEdit.
But I still can not find a way to store the line number of THE first
visible line within Richedit and then return this line to first visible
line after inserting some text.  How to make a line, i.e. line 5 to be
the first visible line?  Thanks.

James

 

Re:RichEdit and Reset First Visible Line


Quote
> Quite a few threads here deal with how to goto a line in a RichEdit.
> But I still can not find a way to store the line number of THE first
> visible line within Richedit and then return this line to first visible
> line after inserting some text.  How to make a line, i.e. line 5 to be
> the first visible line?  Thanks.

  firstline := richedit.perform( EM_GETFIRSTVISIBLELINE, 0 , 0 );

Making the control go back to this line:

  with richedit do
    perform( em_linescroll, 0,
             firstline -
               perform( EM_GETFIRSTVISIBLELINE, 0, 0 )
            );

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:RichEdit and Reset First Visible Line


Thanks Peter, you saved me again.  Just hard to imagine how you could know so
much about Windows API, especially programming was not even your major
(Sorry, I went to read your resume at Borland site half by chance and another
half out of curiosity).

James.

Quote
"Peter Below (TeamB)" wrote:
> > Quite a few threads here deal with how to goto a line in a RichEdit.
> > But I still can not find a way to store the line number of THE first
> > visible line within Richedit and then return this line to first visible
> > line after inserting some text.  How to make a line, i.e. line 5 to be
> > the first visible line?  Thanks.

>   firstline := richedit.perform( EM_GETFIRSTVISIBLELINE, 0 , 0 );

> Making the control go back to this line:

>   with richedit do
>     perform( em_linescroll, 0,
>              firstline -
>                perform( EM_GETFIRSTVISIBLELINE, 0, 0 )
>             );

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Other Threads