Navigation: ABC Library Reference > ASCIISearchClass > AsciiSearchClass Methods >====== Ask (solicit search specifications) ====== | |
Ask( [startline] ), VIRTUAL
Ask | Prompts the end user for search specifications then positions to the specified search value. |
startline | The offset or position of the line at which to begin the search, typically the current line position. If omitted, startline defaults to one (1). |
The Ask method prompts the end user for search specifications then positions the file to the next line subject to the search specifications, or issues an appropriate message if the search value is not found.
Implementation:
The Ask method prompts the end user for search specifications including a value to search for, the direction of the search, and whether the search is case sensitive. If the user invokes the search (doesn't cancel), the Ask method positions the file to the next line containing the search value, or issues an appropriate message if the search value is not found.
Example:
ACCEPT
CASE FIELD()
OF ?PrintButton
IF EVENT() = EVENT:Accepted
IF ViewerActive THEN Viewer.Printer.Ask.
END
OF ?Search !on “search” button
IF EVENT() = EVENT:Accepted
IF ViewerActive !call Searcher.Ask method
StartSearch=CHOOSE(CHOICE(?AsciiBox)>0, |! passing the currently
Viewer.TopLine+CHOICE(?AsciiBox)-1,1) ! selected line as the
Viewer.Searcher.Ask(StartSearch) ! search's starting point
END
END
END
END