From 652a2850b0f8f80f5bd470850ae244ff0ccebaca Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Mon, 16 Aug 1999 10:46:07 +0000 Subject: [PATCH] TBrowseDb() source code --- harbour/source/rtl/browdb.prg | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 harbour/source/rtl/browdb.prg diff --git a/harbour/source/rtl/browdb.prg b/harbour/source/rtl/browdb.prg new file mode 100644 index 0000000000..8244c15542 --- /dev/null +++ b/harbour/source/rtl/browdb.prg @@ -0,0 +1,48 @@ +// TBrowseDb() source code + +function TBrowseDb( nTop, nLeft, nBott, nRight ) + + local oTb := TBrowseNew( nTop, nLeft, nBott, nRight ) + + oTb:SkipBlock := { | n | TBSkip( n ) } + oTb:GoTopBlock := { || DbGoTop() } + oTb:GoBottomBlock := {|| DbGoBottom() } + +Return oTb + +static function TbSkip( nRecs ) + + local nSkipped := 0 + + if _LastRec() != 0 + if nRecs == 0 + DbSkip( 0 ) + elseif nRecs > 0 .and. _Recno() != _LastRec() + 1 + while nSkipped < nRecs + DbSkip( 1 ) + if Eof() + DbSkip( -1 ) + exit + endif + ++nSkipped + end + elseif nRecs < 0 + while nSkipped > nRecs + DbSkip( -1 ) + if Bof() + exit + endif + --nSkipped + end + endif + endif + +return nSkipped + +static function _LastRec() // Waiting for those function to become available + +return 0 + +static function _RecNo() // Waiting for those function to become available + +return 0