> Anyone has an example that allows to accept a filename after D&D that
works on Windows/OSX/Linux?

Nobody knows? John? I'll be happy with any hints I can try...

Paul.

On Sat, Aug 3, 2013 at 9:11 PM, Paul K <paulclin...@yahoo.com> wrote:
> Hi All,
>
> I'm trying to make my application accept files that can be dragged on
> it. This is what I currently have:
>
>   pcall(function() frame:DragAcceptFiles(true) end)
>   frame:Connect(wx.wxEVT_DROP_FILES, function(evt)
>       local files = evt:GetFiles()
>       -- do something to open files
>     end)
>
> This works on Windows, but doesn't work on OSX at all (this is why I
> have the call wrapped in pcall) and only copies filename on Linux
> (instead of opening the file).
>
> I read that DragAcceptFiles is deprecated and should be replaced with
> drop target processing
> (http://wxwidgets.10942.n7.nabble.com/Why-EVT-DROP-FILES-is-not-on-all-wx-ports-td7164.html).
>
> This is what I'm trying to do:
>
>   local filedo = wx.wxFileDataObject()
>   local droptarget = wx.wxDropTarget --(filedo) -- doesn't work, see below
>   function droptarget:OnData(x, y, result) return result end
>   function droptarget:OnDrop() return true end
>   frame:SetDropTarget(droptarget)
>
> SetDropTarget requires wxDropTarget object passed to it, but
> wx.wxDropTarget is an empty table and doesn't have "new" method to
> construct an object. Also, theer is no wxFileDropTarget (only
> wxDropTarget), so I'm not sure how it's supposed to work. I found one
> relevant feature request
> (http://sourceforge.net/p/wxlua/feature-requests/3/) that was closed
> as "fixed", but the Lua code that is in that ticket doesn't work for
> me.
>
> Anyone has an example that allows to accept a filename after D&D that
> works on Windows/OSX/Linux? Thank you.
>
> Paul.

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to