HOWTO Drop a file?

BlitzMax Forums/Brucey's Modules/HOWTO Drop a file?

MOBii(Posted 2016) [#1]
I been testing:
wx.wxDropSource
wx.wxDropTarget

If I drag a file from Explorer to my application
With what function/library can I catch the filename?


Henri(Posted 2016) [#2]
Hi,

you need to use wxFileDropTarget to receive files from Explorer. Something like:
Type MyFileDropTarget Extends wxFileDropTarget

	Field m_owner:wxListCtrl
	
	Method CreateTarget:MyFileDropTarget(owner:wxListCtrl)
		m_owner = owner
		Super.Create()
		Return Self
	End Method

	Method OnDropFiles:Int(x:Int, y:Int, data:String[])
	
		'Show what was dropped
		For Local s:String = EachIn data
			DebugLog s
		Next
			
		'm_owner.InsertStringItem(0, data)
		Return True
	End Method

End Type



There is a TextDrop-sample in wx folder which can be used as a basis.

-Henri


MOBii(Posted 2016) [#3]
Thank thee
I still use MinGW.4.7.1 and in this old wx.mod I can't compile wxFileDropTarget
I try cheat as always, I copy the new wxfiledroptarget.mod aimed for MinGW.5.1 to my old wx.mod but that was less possible to compile.


I am a coward if I change my working MinGW.4.7.1 to MinGW.5.1 and fail compile the new wx.mod, and then continue failing to revert back to MinGW.4.7.1, the I am literary going to cry until i die!
I order a new Windows tablet that come any day now, When it come I try make MinGW.5.1 with the new wx.mod work on that before I try do anything stupid

I think in theory I can just copy the working wx.mod and MinGW.4.7.1 and replace my MinGW with the 5.1 and test compile the new wx.mod
But as I say I am to cowardly to test on this computer!

Hopefully some day I can test wxFileDropTarget with a working MinGW.5.1