CREATE Form AS QFORM CREATE Box AS QRICHEDIT Align = 5 HideSelection = 0 LoadFromFile("test.txt") END CREATE CREATE Button AS QBUTTON Align = 2 Caption = "Go to line 1" OnClick = GoToLine END CREATE CREATE TrackBar AS QTRACKBAR Align = 2 Height = 20 OnChange = Track END CREATE Center ShowModal END CREATE
SUB Track TrackBar.Max = Box.LineCount Button.Caption = "Go to line " + STR$(TrackBar.Position) END SUB '#####
SUB GoToLine '##### Line = TrackBar.Position - 1 Box.SelStart = INSTR(Box.Text, Box.Line(Line)) - 1 Box.SelLength = LEN(Box.Line(Line)) END SUB
As a variation, comment out the two lines marked '##### and see the difference.