The objective is to achieve pajama effect without calling OrdKeyNo() at all or if that is not possible to greatly minimize the number of calls to this function.
Here is an attempt, which greatly reduces the calls but does not totally avoid. Though I have used DBFCDX, the same logic applies to ADS.
Code: Select all
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
//----------------------------------------------------------------------------//
REQUEST DBFCDX
static nRowNo
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBrw
USE CUSTOMER
SET ORDER TO TAG FIRST
SET FILTER TO !DELETED()
GO TOP
nRowno := 1
DEFINE DIALOG oDlg SIZE 600,600 PIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS ALIAS 'CUSTOMER' AUTOSORT CELL LINES NOBORDER
WITH OBJECT oBrw
:bClrStd := { || If( nRowNo % 2 == 1, { CLR_BLACK, CLR_WHITE }, { CLR_BLACK, CLR_YELLOW } ) }
:bGoTop := { || ( oBrw:cAlias )->( DbGoTop() ), nRowNo := 1 }
:bGoBottom := { || ( oBrw:cAlias )->( DbGoBottom(), nRowNo := OrdKeyCount() ) }
:bBookMark := { |x| If( x == nil, ( oBrw:cAlias )->( RecNo() ), ( oBrw:cAlias )->( DbGoTo( x ), nRowNo := OrdKeyNo(), x ) ) }
:bSkip := { |n| ( oBrw:cAlias )->( MySkipper( n ) ) }
:bRClicked := { || oBrw:Refresh() }
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return (0)
//----------------------------------------------------------------------------//
init procedure PrgInit
SET DATE ITALIAN
SET CENTURY ON
SET DELETED ON
SET EXCLUSIVE OFF
RDDSETDEFAULT( "DBFCDX" )
XbrNumFormat( 'E', .t. )
return
//----------------------------------------------------------------------------//
static function MySkipper( nToSkip )
local nSkipped := DbSkipper( IfNil( nToSkip, 1 ) )
nRowNo += nSkipped
return nSkipped
//----------------------------------------------------------------------------//