Code: Select all
// FiveWin - own Drag&Drop new features !!!
// Drag item from one listbox to another listbox
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, oCursor, oLbx, oLbx2
local cItem:=""
DEFINE CURSOR oCursor hand
DEFINE WINDOW oWnd TITLE "FiveWin's own Drag & Drop features!!!"
@ 6, 3 LISTBOX oLbx VAR cItem ;
ITEMS { "Item 1","Item 2","Item 3","Item 4" } SIZE 400, 400
// Set a DropOver action for the ListBox
oLbx:bDropOver = { | uDropInfo, nRow, nCol, nKeyFlags | ;
oLbx:Add( uDropInfo ), oLbx2:del(), MsgBeep() }
oLbx:oDragCursor = oCursor // Select a Drag cursor
oLbx:bDragBegin = { | nRow, nCol, nKeyFlags | ;
SetDropInfo( oLbx:getSelText() ),; // Save drop info !!!
oWnd:SetMsg( "Dragging..." ) }
@ 6, 30 LISTBOX oLbx2 var cItem;
ITEMS {} size 400,400
// Set a DropOver action for the ListBox
oLbx2:bDropOver = { | uDropInfo, nRow, nCol, nKeyFlags | ;
oLbx2:Add( uDropInfo ), oLbx:del(), MsgBeep() }
oLbx2:oDragCursor = oCursor // Select a Drag cursor
oLbx2:bDragBegin = { | nRow, nCol, nKeyFlags | ;
SetDropInfo( oLbx2:getSelText() ),; // Save drop info !!!
oWnd:SetMsg( "Dragging..." ) }
SET MESSAGE OF oWnd ;
TO "FiveWin - own DragDrop interface !!!" CENTER
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
//----------------------------------------------------------------------------//