#include 'fivewin.ch'
FUNCTION Main()
LOCAL oWnd, oBrw, oCur, i, aData := {}
FOR i := 1 TO 6
AAdd( aData, { str(i,2), "Description " + Str( i ), Replicate( Chr( 64 + i ), 5 ) } )
NEXT i
DEFINE CURSOR oCur DRAG
DEFINE WINDOW oWnd
oBrw := TXBrowse():New( oWnd )
oBrw:SetArray( aData )
oBrw:CreateFromCode()
oWnd:oClient := oBrw
//
oBrw:oDragCursor := oCur
oBrw:bDragBegin := { |nRow,nCol,nFlags| DragBegin( nRow, nCol, nFlags, oBrw ) }
oBrw:bDropOver := { |uDropInfo, nRow, nCol, nFlags| DropOver( uDropInfo, nRow, nCol, nFlags, oBrw ) }
//
ACTIVATE WINDOW oWnd
oCur:End()
RETURN NIL
STATIC FUNCTION DragBegin( nRow, nCol, nFlags, oBrw )
SetDropInfo( EVAL( oBrw:SelectedCol():bStrData ) )
RETURN NIL
STATIC FUNCTION DropOver( uDropInfo, nRow, nCol, nFlags, oBrw )
oBrw:lButtonDown( nRow, nCol, nFlags)
oBrw:lButtonUp( nRow, nCol, nFlags)
MsgInfo( uDropInfo + CRLF + 'dropped on' + CRLF + ;
EVAL( oBrw:SelectedCol():bStrData ) )
RETURN NIL
function CheckListbox( nRow, nCol, oBrw, oLbx, nKeyFlags,oChild )
if nRow < oBrw:HeaderHeight()
oBrw:PageUp()
elseif nRow > ( oBrw:BrwHeight() - oBrw:FooterHeight() )
oBrw:PageDown()
endif
return nil
before function Main:
REQUEST DBFCDX
// change the dbf open code like this:
USE C:\FWH\samples\LEXIKON.DBF NEW ALIAS LEX EXCLUSIVE VIA 'DBFCDX'
DBEVAL( {|| LEX->NUMMER := RECNO() } )
SET ORDER TO TAG NUMMER
GO TOP
// replace the new drag and drop functions given below
STATIC FUNCTION DragBegin( nRow, nCol, nFlags, oBrw )
SetDropInfo( (oBrw:cAlias)->( recno() ) )
RETURN NIL
STATIC FUNCTION DropOver( uDropInfo, nRow, nCol, nFlags, oBrw )
LOCAL nDragRec := uDropInfo
LOCAL nThisRec
LOCAL nThisKey
LOCAL nPrevKey := 0
oBrw:lButtonDown( nRow, nCol, nFlags )
oBrw:lButtonUp( nRow, nCol, nFlags )
nThisRec := (oBrw:cAlias)->( RECNO() )
nThisKey := (oBrw:cAlias)->NUMMER
( oBrw:cAlias )->( dbSKIP( -1 ) )
IF !(oBrw:cAlias)->( bof() )
nPrevKey := ( oBrw:cAlias )->NUMMER
ENDIF
( oBrw:cAlias )->( dbGOTO( nDragRec ) )
( oBrw:cAlias )->NUMMER := ( nThisKey + nPrevKey ) / 2
( oBrw:cAlias )->( dbGOTO( nThisRec ) )
oBrw:Refresh()
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 57 guests