METHOD Select( nOperation ) CLASS TXBrowse
local uBook, uCurRow, uOldRow, uTemp
local aTemp
local nAt, nLen
local lRefresh
Local cStIndexKey := ""
Local cEndIndexKey := ""
if .not. ::lMultiSelect // ::nMarqueeStyle != MARQSTYLE_HIGHLROWMS .and. ::nMarqueeStyle != MARQSTYLE_HIGHLWIN7
return nil
endif
DEFAULT nOperation := 1
do case
case nOperation == 0 // delete all
if Len( ::aSelected ) == 1 .and. Eval( ::bBookMark ) == ::aSelected[ 1 ]
lRefresh := .f.
else
lRefresh := .t.
endif
::aSelected := {}
if ! Empty( ::nSaveMarq )
::nMarqueeStyle := ::nSaveMarq
::nSaveMarq := nil
endif
if lRefresh
// ::lRefreshOnlyData := .t.
::GetDC()
::Super:Refresh( .t. ) // ::Paint()
::ReleaseDC()
endif
case nOperation == 1 .or. ( Len( ::aSelected ) == 0 .and. nOperation != 4 )// Add current
uBook := Eval( ::bBookMark )
nAt := Ascan( ::aSelected, uBook )
if nAt == 0
Aadd( ::aSelected, uBook )
::DrawLine( .t. )
endif
case nOperation == 2 // Swap key (Ctrl+LClick)
uBook := Eval( ::bBookMark )
nAt := Ascan( ::aSelected, uBook )
if nAt > 0
::DrawLine( .f. )
::aSelected[ nAt ] := Atail( ::aSelected )
Asize( ::aSelected, Len( ::aSelected ) - 1 )
else
Aadd( ::aSelected, Eval( ::bBookMark ))
::DrawLine( .t. )
endif
case nOperation == 3 // Shift & lclick
cEndIndexKey := &( ( ::cAlias )->(IndexKey()) )
uBook := Eval( ::bBookMark )
uCurRow := ::KeyNo()
Eval( ::bBookMark, Atail( ::aSelected ) )
uOldRow := ::KeyNo()
cStIndexKey := &( ( ::cAlias )->(IndexKey()) )
if uOldRow != uCurRow
::aSelected := { Atail( ::aSelected ) }
if IF( ( ::cAlias )->( RddName() ) == "SQLRDD", cEndIndexKey > cStIndexKey, uCurRow > uOldRow)
CursorWait()
do while ( uTemp := Eval( ::bBookMark ) ) != uBook .and. ! ::Eof()
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
Endif
::Skip( 1 ) // Eval( ::bSkip, 1 )
enddo
CursorArrow()
else
CursorWait()
do while ( uTemp := Eval( ::bBookMark ) ) != uBook .and. ! ::Bof()
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
endif
::Skip( -1 ) // Eval( ::bSkip, -1 )
enddo
CursorArrow()
endif
Aadd( ::aSelected, uBook )
Eval( ::bBookMark, uBook )
// ::lRefreshOnlyData := .t.
::GetDC()
::Paint()
::ReleaseDC()
else
Eval( ::bBookMark, uBook )
endif
case nOperation == 4 // Select all
uBook := Eval( ::bBookMark )
::aSelected := Array( ::KeyCount() )
nAt := 1
nLen := ::nLen
aTemp := ::aSelected
CursorWait()
Eval( ::bGotop )
do while nAt <= nLen //.and. !Eval( ::bEof )
aTemp[ nAt++ ] := Eval( ::bBookMark )
::Skip( 1 ) //Eval( ::bSkip, 1 )
enddo
Eval( ::bBookMark, uBook )
CursorArrow()
// ::lRefreshOnlyData := .t.
::GetDC()
::Paint()
::ReleaseDC()
case nOperation == 5 // Swap key (Shift + GoDown or GoUp)
uCurRow := ::KeyNo()
nAt := Ascan( ::aSelected, uCurRow )
uBook := Eval( ::bBookMark )
if nAt == 1 .and. len( ::aSelected ) == 1
return nil
elseif nAt == 0
Aadd( ::aSelected, uBook )
::DrawLine( .t. )
else
if nAt != len( ::aSelected )
Asize( ::aSelected, Len( ::aSelected ) - 1 )
::Refresh()
endif
endif
end case
return nil
But doesnt that mean that the browse must be in recno() order?
Enrico Maria Giordano wrote:Using ADO, OrdKey() can be replaced by oRs:AbsolutePosition and OrdKeyGoTo( n ) by oRs:AbsolutePosition = n.
I don't know if it can be of any help.
EMG
oxBrw:bKeyNo = oxBrw:bBookMark
METHOD MouseLeave( nRow, nCol, nFlags ) CLASS TXBrowse
::lPressed = .f.
if ( ::cAlias )->( RddName() ) <> "SQLRDD"
::Refresh()
endif
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 47 guests