[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SkipBlock (Assignable)
Contains a code block that repositions the data source. During
stabilization, this code block is executed with a numeric argument
when the TBrowse object needs to reposition the data source. The
numeric argument passed to the block represents the number of records
to be skipped. A positive value means skip forward, and a negative
value means skip backward. A value of zero indicates that the data
source does not need to be repositioned, but the current record may
need to be refreshed. Typically the data source is a database file,
and this block calls a user-defined function that executes a SKIP
command to reposition the record pointer.
The block must return the number of rows (positive, negative, or
zero) actually skipped. If the value returned is not the same as the
value requested, the TBrowse object assumes that the skip operation
encountered the beginning or end of file.
oTB:SkipBlock := {|nSkip| SkipDB(nSkip, @nLine)}
FUNCTION SkipDB( nRequest, nLine )
// nLine is a reference
LOCAL nActually := 0
IF nRequest == 0
DBSKIP(0)
ELSEIF nRequest > 0 .AND. !EOF()
WHILE nActually < nRequest
IF nLine < LAST_LINE
// This will print up to LAST_LINE of text
// Some of them (or even all) might be empty
++nLine
ELSE
// Go to the next record
DBSKIP(+1)
nLine := 1
ENDIF
IF EOF()
DBSKIP(-1)
nLine := LAST_LINE
EXIT
ENDIF
nActually++
END
ELSEIF nRequest < 0
WHILE nActually > nRequest
// Go to previous line
IF nLine > 1
--nLine
ELSE
DBSKIP(-1)
IF !BOF()
nLine := LAST_LINE
ELSE
// You need this. Believe me!
nLine := 1
GOTO RECNO()
EXIT
ENDIF
ENDIF
nActually--
END
ENDIF
RETURN (nActually)
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson