User Tools

Site Tools


setup_set_search_constraints_.htm
Navigation:  ABC Library Reference > ASCIISearchClass > AsciiSearchClass Methods >====== Setup (set search constraints) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

Setup( constraints [, startline] )

blk2blue.jpg

Setup Sets the search constraints.
constraints The label of a structure containing the search constraints. The structure must have the same structure as the FindGroup GROUP declared in ABASCII.INC.
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 Setup method sets the search constraints. The AsciiSearchClass object applies the constraints when searching the text file.

Implementation:

The ABC Library does not call the Setup method. The Setup method is provided so you can do custom searches outside the normal AsciiViewerClass process (without using the Ask method).

The Next method applies the search constraints set by the Setup method. The constraints include the text to search for, the direction in which to search, and whether or not the search is case sensitive.

The FindGroup GROUP is declared in ABASCII.INC as follows:

FindGroup  GROUP,TYPE

What     PSTRING(64)   !text to look for

MatchCase   BYTE       !case sensitive?

Direction   STRING(4)  !either 'Up  ' or 'Down'

     END

Example:

MyAsciiSearchClass.Ask PROCEDURE

Constraints  LIKE(FindGroup)

CODE

Constraints.MatchCase = False       !never case sensitive

Constraints.Direction = 'Down'      !always search downward

!prompt end user for search value

SELF.Setup(Constraints,StartLine)   !set search constraints

SELF.LineCounter=SELF.Next()        !execute search

IF SELF.LineCounter

!set to next line containing search value:

 SELF.FileMgr.SetLine(SELF.LineCounter)

ELSE

 MESSAGE(&CLIP(SELF.Constraints.What)&''' not found.')

END

See Also:     Ask, Next

setup_set_search_constraints_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)