DbfBrowser event order
Publicado: Mar May 15, 2007 4:13 pm
Hi,
which events and in which order are triggered in DbfBrowser, when I want to reach the last
visible record and press Ctrl-PgDn? In the debugger I see the next story:
First the OnGoBottom event is triggered, this function sets the correct record position.
When the DbfBrowse1GoBottom() method is finished, immediatly follows the DbfBrowse1Skip()
method, where the record pointer is on the last logical record in the file and not there,
where it was in the previous method. What happens between OnGoBottom and OnSkip events?
Skipping thrue the visible records works fine, the browser always stops on the last
visible record.
The OnSkip and OnGoBottom events are defined:
********************************************
METHOD DbfBrowse1GoBottom( oSender ) CLASS TForm2
LOCAL nRecno
Fakvydr->(BlockBottom(RTRIM(Fakvyd->CisloFakt)))
// the Fakvydr->(Recno()) is here 1520, which is the desired last visible record
RETURN Nil
*****************************************
METHOD DbfBrowse1Skip( oSender, nSkip ) CLASS TForm2
LOCAL nRealSkip
// Here is the Fakvydr->(Recno()) is 680, which contains the last logical record in the
index order
,
nRealSkip := Fakvydr->(Pozicia(nSkip))
RETURN nRealSkip
*****************************************
FUNCTION BlockBottom(xPar)
// this function sends the record pointer beyond the last visible record generating the
// next index key, and skips 1 record back to display the last desired record
LOCAL xUtolso
IF VALTYPE(xPar) == 'C'
xPar := ALLTRIM(xPar)
xUtolso := LEFT(xPar,LEN(xPar)-1) + Chr(Asc(Right(xPar,1))+1)
ELSE
xUtolso := xPar + 1
ENDIF
DBSEEK(xUtolso,.T.)
IIF(!Eof(),DbSkip(-1),Nil)
RETURN NIL
*****************************************
Gejza Horvath
which events and in which order are triggered in DbfBrowser, when I want to reach the last
visible record and press Ctrl-PgDn? In the debugger I see the next story:
First the OnGoBottom event is triggered, this function sets the correct record position.
When the DbfBrowse1GoBottom() method is finished, immediatly follows the DbfBrowse1Skip()
method, where the record pointer is on the last logical record in the file and not there,
where it was in the previous method. What happens between OnGoBottom and OnSkip events?
Skipping thrue the visible records works fine, the browser always stops on the last
visible record.
The OnSkip and OnGoBottom events are defined:
********************************************
METHOD DbfBrowse1GoBottom( oSender ) CLASS TForm2
LOCAL nRecno
Fakvydr->(BlockBottom(RTRIM(Fakvyd->CisloFakt)))
// the Fakvydr->(Recno()) is here 1520, which is the desired last visible record

RETURN Nil
*****************************************
METHOD DbfBrowse1Skip( oSender, nSkip ) CLASS TForm2
LOCAL nRealSkip
// Here is the Fakvydr->(Recno()) is 680, which contains the last logical record in the
index order

nRealSkip := Fakvydr->(Pozicia(nSkip))
RETURN nRealSkip
*****************************************
FUNCTION BlockBottom(xPar)
// this function sends the record pointer beyond the last visible record generating the
// next index key, and skips 1 record back to display the last desired record
LOCAL xUtolso
IF VALTYPE(xPar) == 'C'
xPar := ALLTRIM(xPar)
xUtolso := LEFT(xPar,LEN(xPar)-1) + Chr(Asc(Right(xPar,1))+1)
ELSE
xUtolso := xPar + 1
ENDIF
DBSEEK(xUtolso,.T.)
IIF(!Eof(),DbSkip(-1),Nil)
RETURN NIL
*****************************************
Gejza Horvath