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.

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&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