Code: Alles auswählen
; Enumeration ; hier sind die gadgets
; #Hauptfenster
; #explorerfeld1
; #explorerfeld2
; EndEnumeration
If OpenWindow(0, 200, 200, 430, 400, "Drag & Drop", #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ExplorerListGadget(1, 10, 10, 200, 380, "*", #PB_Explorer_MultiSelect)
ExplorerListGadget(2, 210, 10, 200, 380, "*", #PB_Explorer_MultiSelect)
EnableGadgetDrop(1, #PB_Drop_Files, #PB_Drag_Copy)
EnableGadgetDrop(2, #PB_Drop_Files, #PB_Drag_Copy)
Repeat
event = WaitWindowEvent(0)
If Event = #PB_Event_Gadget And EventType() = #PB_EventType_DragStart
Files$ = ""
If EventGadget() = 1 ;wird beim drag vom ExplorerList 1 ausgeführt
For i = 0 To CountGadgetItems(1)-1
If GetGadgetItemState(1, i) & #PB_Explorer_Selected
Files$ + GetGadgetText(1) + GetGadgetItemText(1, i) + Chr(10)
Debug Files$
EndIf
Next i
EndIf
If EventGadget() = 2 ;wird beim drag vom ExplorerList 1 ausgeführt
For i = 0 To CountGadgetItems(2)-1
If GetGadgetItemState(2, i) & #PB_Explorer_Selected
Files$ + GetGadgetText(2) + GetGadgetItemText(2, i) + Chr(10)
Debug Files$
EndIf
Next i
EndIf
DragFiles(Files$)
ElseIf event = #PB_Event_GadgetDrop
If EventGadget() = 1 ;wird beim drop im ExplorerList 1 ausgeführt
Zieldatei$ = GetGadgetText(1)
Dateien.s = EventDropFiles();
Anzahl = CountString(Dateien, Chr(10)) + 1;
ev = EventDropAction()
Debug Zieldatei$
For I = 1 To Anzahl
If ev = #PB_Drag_Copy
; CopyFile(StringField(Dateien, I, Chr(10)), Zieldatei$)
EndIf
Next
EndIf
If EventGadget() = 2 ;wird beim drop im ExplorerList 2 ausgeführt
Zieldatei$ = GetGadgetText(2)
Dateien.s = EventDropFiles();
Anzahl = CountString(Dateien, Chr(10)) + 1;
ev = EventDropAction() ;
Debug Zieldatei$
For I = 1 To Anzahl
If ev = #PB_Drag_Copy
; CopyFile(StringField(Dateien, I, Chr(10)), Zieldatei$)
EndIf
Next
EndIf
EndIf
Until event = #PB_Event_CloseWindow
EndIf
