drag and drop files onto BMAX window

BlitzMax Forums/BlitzMax Programming/drag and drop files onto BMAX window

The problem is the main BlitzMax window created at runtime is not set to handle drag and drop events. You would need to modify the BlitzMax source code to enable this.

You can, however, drag a file onto your program's .exe (or a shortcut to it) and utilise AppArgs to read the dragged item's name:


SuperStrict

Graphics 640,480,0

For Local i:Int = 0 To (AppArgs.length - 1)
	Print AppArgs[i]
Next

While Not KeyHit( KEY_ESCAPE )

Wend

End



Your users could launch your emulator loading a single ROM in such a way.

Alternatively you could reconsider purchasing the MaxGUI module. Drag and drop is very simple:


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
			    Print EventExtra().ToString()
			    'Useful code here
			EndIf
						
	End Select
	
Wend

End