FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse multiselect
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
xbrowse multiselect
Posted: Thu Apr 05, 2007 10:39 PM

if I use on xbrowse :

oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS

and select many records with mouse and ctrl

can I have on an array asel:={} the records I select ?

Best Regards, Saludos



Falconi Silvio
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: xbrowse multiselect
Posted: Fri Apr 06, 2007 10:05 AM

oBrw:aSelected

EMG

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
xbrowse multiselect
Posted: Tue Apr 10, 2007 11:13 PM

thanks
but How I can print only the record selected
can you make a small sample please

Best Regards, Saludos



Falconi Silvio
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
xbrowse multiselect
Posted: Wed Apr 11, 2007 03: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

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651

Continue the discussion