$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 Font AS QFONT
Font.COLOR = &HFFFFFF
Font.Size = 10
DIM Font1 AS QFONT
Font1.Size = 10
DIM OnScroll AS QTIMER
Onscroll.Interval = 25
Onscroll.OnTimer = Sync
CREATE frmMain AS QFORM
Center
Height = 480
Width = 640
END CREATE
CREATE rftEditor AS QRICHEDIT
PARENT = frmMain
BorderStyle = 0
Font = Font1
Align = alClient
HideScrollBars = 0
ScrollBars = 2
END CREATE
CREATE rftRuler AS QRICHEDIT
PARENT = frmMain
BorderStyle = 0
Font = Font
COLOR = &HCF9A9A
Align = alLeft
Width = 35
END CREATE
DIM t AS INTEGER
FOR t = 0 TO 200
rftRuler.Addstrings STR$(t)
NEXT t
frmMain.SHOWMODAL
SUB Sync
DIM Oldpos AS INTEGER
DIM Position AS INTEGER
Position = SendMessageA( rftEditor.Handle, &Hce, 0, 0)
IF Oldpos <> Position THEN rftRuler.selstart = LEN( rftRuler.text )
SendMessageA( rftRuler.Handle, &Hb7, 0, 0 )
rftRuler.selstart = INSTR( rftRuler.Text, STR$( Position ))
SendMessagea( rftRuler.Handle, &Hb7, 0, 0 )
Oldpos = Position
DIM t AS INTEGER
IF rftruler.linecount<>rfteditor.linecount THEN
FOR t=rftruler.linecount TO rfteditor.linecount
rftruler.addstrings STR$(t)
NEXT
END IF
END SUB
|