Dear friends:
I'm looking for a small sample using ADO (RECORDSET) and TXBrowse, if you have one this will be very very appreciated.
Best Regards
FUNCTION rsxbrowse( rs )
LOCAL oWnd, oBrw, oCol
DEFINE WINDOW oWnd
oBrw := TXBrowse():New(oWnd)
oBrw:bGoTop := {|| rs:moveFirst() }
oBrw:bGoBottom := {|| rs:moveLast() }
oBrw:bSkip := {| n | rsSkipper( n, rs ) }
oBrw:bBof := {|| rs:Bof() }
oBrw:bEof := {|| rs:Eof() }
oBrw:bBookMark := {| bmNew | IIF( bmNew == NIL, rs:bookMark, rs:bookMark := bmNew) }
oBrw:bKeyNo := {|| rs:AbsolutePosition }
oBrw:bKeyCount := {|| rs:RecordCount() }
oCol := oBrw:AddCol()
WITH OBJECT oCol
:bStrData := {|| cValToChar( rs:fields(0):Value ) }
:cHeader := rs:fields(0):Name
END
oCol := oBrw:AddCol()
WITH OBJECT oCol
:bStrData := {|| cValToChar( rs:fields(1):Value ) }
:cHeader := rs:fields(1):Name
END
// and so on for other columns
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
RETURN NIL
//------------------------------------------------------------------------------
STATIC FUNCTION RsSkipper( nToSkip, rs )
LOCAL nSkipped := 0
LOCAL nCurPos
IF nToSkip == NIL
nToSkip := 1
ENDIF
IF rs:RecordCount() > 0
nCurPos := rs:AbsolutePosition
rs:AbsolutePosition := MAX( 1, MIN( nCurPos + nToSkip, rs:RecordCount() ) )
nSkipped := rs:AbsolutePosition - nCurPos
ENDIF
RETURN nSkipped
//------------------------------------------------------------------------------
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 97 guests