$TYPECHECK ON
$INCLUDE "rapidq.inc"
CONST EM_GETFIRSTVISIBLELINE = &HCE
CONST EM_SCROLLCARET = &HB7
DECLARE FUNCTION SendMessagea LIB "user32" ALIAS "SendMessageA"_
(BYVAL hwnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG,_
lParam AS LONG) AS LONG
DECLARE SUB sync
DIM onscroll AS QTIMER
onscroll.interval=50
onscroll.ontimer=sync
CREATE Form AS QFORM
CREATE mainedit AS QRICHEDIT
hidescrollbars=false
scrollbars=ssboth
left=41
END CREATE
CREATE ruler AS QRICHEDIT
width=40
END CREATE
END CREATE
DIM t AS INTEGER
FOR t =0 TO 50
mainedit.addstrings "line "+STR$(t)
ruler.addstrings STR$(t)
NEXT t
ruler.addstrings STR$(t)
ruler.addstrings STR$(t+1)
form.SHOWMODAL
SUB sync
DIM oldpos AS INTEGER,position AS INTEGER
position= SendMessageA(mainedit.Handle, &Hce, 0, 0)
IF oldpos<>position THEN
ruler.selstart=LEN(ruler.text)
SendMessagea(ruler.Handle, &Hb7, 0, 0)
ruler.selstart=INSTR(ruler.text,STR$(position))
SendMessagea(ruler.Handle, &Hb7, 0, 0)
oldpos=position
END IF
END SUB
|