Code: Select all
EnableExplicit
#Window = 0
Enumeration
#SourcePrivate
EndEnumeration
Define tmp$, tmp, ind, i
If OpenWindow(#Window, 0, 0, 760, 520, "Drag & Drop", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListViewGadget(#SourcePrivate, 10, 10, 740, 500)
For i = 1 To 9
AddGadgetItem(#SourcePrivate, -1, "item " + Str(i))
Next
;
EnableGadgetDrop(#SourcePrivate, #PB_Drop_Private, #PB_Drag_Copy, 2)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
If EventType() = #PB_EventType_DragStart
Select EventGadget()
Case #SourcePrivate
ind = GetGadgetState(#SourcePrivate)
tmp$ = GetGadgetText(#SourcePrivate)
DragPrivate(2) ; EnableGadgetDrop ... 2
EndSelect
EndIf
Case #PB_Event_GadgetDrop
Select EventGadget()
Case #SourcePrivate
RemoveGadgetItem(#SourcePrivate, ind)
AddGadgetItem(#SourcePrivate, -1, tmp$)
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf