Click to See Complete Forum and Search --> : save / jump to scroll position in a richtextbox


tatou
February 4th, 2000, 10:27 AM
i'm developing an editor control in VB6 based on a rich text box which syntax highlightd for a programming language. my highlighting subroutine actually inserts the RTF code and replaces the .textRTF property every time it is run.

the trouble is, this routine sets the cursor position to 1 and scrolls up to the top of the box every time, and i just want it to appear to the user that the contents were colorized, and no scrolling took place.

is there a way to (possibly using the API):
- suspend refresh
- save the number of the first line visible in the rtbox
- EXECUTE MY HIGHLIGHTING SUBROUTINE
- jump back to that line number
- resume refresh

so that the highlighting looks smooth?

Lothar Haensler
February 4th, 2000, 10:46 AM
>is there a way to (possibly using the API):
> suspend refresh
LockWindowUpdate API
>- save the number of the first line visible in the rtbox
Sendmessage(...EM_GETFIRSTVISIBLELINE...)

>- jump back to that line number
SendMessage(...EM_SETSEL...)
>- resume refresh

LockWindowUpdate again