by ShumingWang » Wed Apr 11, 2007 3:54 am
oRpt:bSkip := { || oRpt:Cargo := ::rptSKIP( ) }
Method Rptskip() class Txbrowse
local n1,n1old
n1old:=::skip(1)
n1:=n1old
IF len(::aSelected)>0
While AScan( ::aSelected, If( ::nDatatype==DATATYPE_ARRAY,::nArrayAt,eval(::bKeyno)))==0
n1+=::skip(1)
if ::nDATATYPE<>DATATYPE_ARRAY
if eval(::bKeyno)==eval(::bkeyCount)
n1:=0
exit
end
else
if ::nArrayAt==len(::aArray)
n1:=0
exit
end
end
if n1==n1old
exit
end
n1old:=n1
enddo
end
If you want a more better method select()
#ifdef __HARBOUR__
METHOD Select( nOperation ) CLASS TXBrowse
#else
METHOD _Select( nOperation ) CLASS TXBrowse
#endif
local uBook, uCurRow, uOldRow, uTemp
local aTemp
local nAt, nLen
local lRefresh
if ::nMarqueeStyle != MARQSTYLE_HIGHLROWMS
return nil
endif
DEFAULT nOperation := 1
do case
case nOperation == 0 // delete all
if len( ::aSelected ) == 1 .and. Eval( ::bBookMark,, Self ) == ::aSelected[ 1 ]
lRefresh := .f.
else
lRefresh := .t.
endif
::aSelected := {}
if lRefresh .and. ::lCreated
::lRefreshOnlyData := .t.
::GetDC()
::Paint()
::ReleaseDC()
endif
case nOperation == 1
// .or. ( len( ::aSelected ) == 0 .and. nOperation != 4 )// Add current
// xtech
uBook := Eval( ::bBookMark,, Self )
nAt := Ascan( ::aSelected, uBook )
if nAt == 0
// Aadd( ::aSelected, uBook )
// xtech
If ::lCreated
::DrawLine( .t. )
Endif
endif
case nOperation == 2 // Swap key (Ctrl+LClick)
uBook := Eval( ::bBookMark,, Self )
nAt := Ascan( ::aSelected, uBook )
if nAt > 0
If ::lCreated
::DrawLine( .f. )
endif
::aSelected[ nAt ] := Atail( ::aSelected )
Asize( ::aSelected, len( ::aSelected ) - 1 )
else
Aadd( ::aSelected, Eval( ::bBookMark ))
If ::lCreated
::DrawLine( .t. )
endif
endif
case nOperation == 3 // Shift & lclick
uBook := Eval( ::bBookMark,, Self )
uCurRow := Eval( ::bKeyNo,,Self )
Eval( ::bBookMark, Atail( ::aSelected ), Self )
uOldRow := Eval( ::bKeyNo,,Self )
if uOldRow != uCurRow
::aSelected := { Atail( ::aSelected ) }
if uCurRow > uOldRow
CursorWait()
do while ( uTemp := Eval( ::bBookMark,, Self ) ) != uBook .and. !Eval( ::bEof, Self )
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
Endif
Eval( ::bSkip, 1, Self )
enddo
CursorArrow()
else
CursorWait()
do while ( uTemp := Eval( ::bBookMark,, Self ) ) != uBook .and. !Eval( ::bBof, Self )
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
endif
Eval( ::bSkip, -1, Self )
enddo
CursorArrow()
endif
Aadd( ::aSelected, uBook )
Eval( ::bBookMark, uBook, Self )
::lRefreshOnlyData := .t.
If ::lCreated
::GetDC()
::Paint()
::ReleaseDC()
endif
else
Eval( ::bBookMark, uBook, Self )
endif
case nOperation == 4 // Select all
uBook := Eval( ::bBookMark,, Self )
::aSelected := Array( ::KeyCount() )
nAt := 1
nLen := ::nLen
aTemp := ::aSelected
CursorWait()
Eval( ::bGotop, Self )
do while nAt <= nLen //.and. !Eval( ::bEof )
aTemp[ nAt++ ] := Eval( ::bBookMark,, Self )
Eval( ::bSkip, 1, Self )
enddo
Eval( ::bBookMark, uBook, Self )
CursorArrow()
::lRefreshOnlyData := .t.
If ::lCreated
::GetDC()
::Paint()
::ReleaseDC()
Endif
end case
return nil
return n1