Navigation: ABC Library Reference > ASCIIViewerClass > AsciiViewerClass Methods >====== SetLine (position to specific line) ====== | |
SetLine( line number ), PROTECTED, VIRTUAL
SetLine | Positions the ASCIIViewerClass object to a specific line. |
line number | An integer constant, variable, EQUATE or expresssion that contains the offset or position of the line of text to position to. |
The SetLine method positions the ASCIIViewerClass object to a specific line within the browsed file.
Implementation:
The AskGotoLine method, the ASCIIFileClass.SetPercentile method, and the ASCIISearchClass.Ask method all use the SetLine method to position to the required text line.
Example:
MyViewerClass.AskGotoLine PROCEDURE
LineNo LONG,STATIC
OKGo BOOL(False)
GotoDialog WINDOW('Goto'),AT(,,96,38),GRAY,DOUBLE
SPIN(@n_5),AT(36,4,56,13),USE(LineNo),RANGE(1,99999)
PROMPT('&Line No:'),AT(4,9,32,10),USE(?Prompt1)
BUTTON('&Go'),AT(8,22,40,14),USE(?GoButton)
BUTTON('&Cancel'),AT(52,22,40,14),USE(?CancelButton)
END
CODE
OPEN(GotoDialog)
ACCEPT
CASE EVENT()
OF EVENT:Accepted
CASE ACCEPTED()
OF ?GoButton
OKGo=True
POST(EVENT:CloseWindow)
OF ?CancelButton
POST(EVENT:CloseWindow)
END
END
END
CLOSE(GotoDialog)
IF OKGo THEN SELF.SetLine(LineNo).
See Also: AskGoToLine, ASCIIFileClass.SetPercentile, ASCIISearchClass.Ask