From ahk:
Code: Select all
https://autohotkey.com/docs/commands/ListView.htm#notify
D: The user has attempted to start dragging a row or icon (there is currently no built-in support for dragging rows or icons). The variable A_EventInfo contains the focused row number. In v1.0.44+, this notification occurs even without AltSubmit.
Code: Select all
https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm
$GUI_DROPACCEPTED (8) - Control will accept drop action : from file or from a drag of another control. See remarks.
If $GUI_DROPACCEPTED (8) is set to a visible control a drag & drop can be taken in account. The edit/input control will be set with the filename.
For other controls on reception of $GUI_EVENT_DROPPED, @GUI_DragId will return the controlID from where the drag start (-1 if from a file, @GUI_DragFile contain the filename being dropped) and @GUI_DropId returns the controlID of the dropped control.
Only dragging a ListviewItem will start the drag & drop process. The @GUI_DragId will be the ListView controlID.
Code: Select all
Dim $LISTVIEW_ITEM[10]
$GUI = GUICreate("Drag'n'Drop",800,600,-1,-1)
$LISTVIEW_LEFT = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4",0,0,400,600)
GUICtrlSetState(-1, 8) ; $GUI_DROPACCEPTED = 8
For $i = 0 To 9
$LISTVIEW_ITEM[$i] = GUICtrlCreateListViewItem("Item "&$i,$LISTVIEW_LEFT)
Next
$LISTVIEW_RIGHT = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4",400,0,400,600)
GUICtrlSetState(-1, 8) ; $GUI_DROPACCEPTED = 8
GUISetState(@SW_SHOW)
While True
Switch GUIGetMsg()
Case -3
ExitLoop
Case -13
MoveItem(@GUI_DragId, @GUI_DropId)
EndSwitch
WEnd
Func MoveItem($drag, $drop)
GUICtrlCreateListViewItem(GUICtrlRead(GUICtrlRead($drag)), $drop)
GUICtrlDelete(GUICtrlRead($drag))
EndFunc