On Sat, Apr 7, 2012 at 7:40 PM, strawman <straw...@lavabit.com> wrote:
>  From the wx docs for wxDataObjectSimple:
>
> "Notice that this is still an abstract base class and cannot be used but
> should be derived from.
> The objects supporting rendering the data must override GetDataSize and
> GetDataHere while the objects which may be set must override SetData."
>
> Is it possible to use this class from Lua?  I'm trying to register a
> custom clipboard format and can't see any other way of passing a custom
> wxDataFormat.

I just added it, you can of course simply use a seriallized string for
exchanging any kind of data and in some cases that might be simplest.

However to use a wxDataObjectSimple, get the newest version of wxLua
from subversion.

Usage is as follows:

------------------------
d = wx.wxLuaDataObjectSimple(wx.wxDataFormat("asd"))

d.data = "x" -- store the data somewhere

print(d:SetData("aaa"), d.data, d:GetDataSize(), d:GetDataHere())

d.GetDataSize = function(d) return string.len(d.data) end
d.GetDataHere = function(d) return true, d.data end -- len must equal
GetDataSize()
d.SetData     = function(d,s) d.data = s; return true end

print(d:SetData("aaa"), d.data, d:GetDataSize(), d:GetDataHere())
-----------------------------
output will be:

false   x       0       false   
true    aaa     3       true    aaa


I have not had time to test it further, but it should work with the
clipboard, please let me know if it doesn't.

Regards,
     John

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to