Drag and Drop
BlitzMax Forums/BlitzMax Programming/Drag and Drop
| ||
| Hi I get a problem with drag and drop. It is possible to get each drag n dropped files one by one ? Actually i'm using this, the problem is that the returned information is ony one string. Is there a command to extract each filename ? Thanks |
| ||
SuperStrict
Local Window:TGadget = CreateWindow("Launcher", 40, 40, 320, 240, ,WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_ACCEPTFILES)
While True
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_WINDOWACCEPT
If EventSource() = Window
Local files:String[] = (EventExtra().ToString()).Split("~n")
For Local file:String = EachIn files
Print "Filax Ficher: ~q"+file+"~q"
Next
'Useful code here
EndIf
End Select
Wend
End;) |
| ||
As fredborg said, although I thought I'd mention you don't need to create a variable for the separate array of files if you are just looping through them... If I remember correctly, the (EventExtra().ToString()).Split("~n") will only be evaluated once for the loop, so will be just as fast. I.e.SuperStrict
Local Window:TGadget = CreateWindow("Launcher", 40, 40, 320, 240, ,WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_ACCEPTFILES)
Repeat
Select WaitEvent()
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE;End
Case EVENT_WINDOWACCEPT
If EventSource() = Window Then
For Local strFile$ = EachIn (EventExtra().ToString()).Split("~n")
Print "Filax Ficher: ~q" + strFile + "~q"
Next
EndIf
End Select
Forever |
| ||
| Many thanks :) |