On 09/04/2012 04:57, John Labenski wrote:
> 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.

Thanks for the update; the example above works as shown, however it 
doesn't seem to play nicely with the clipboard:

fmt = wx.wxDataFormat("HTML Format")
obj = wx.wxLuaDataObjectSimple(fmt)
obj.data = "test"
function obj:GetDataHere() return true, self.data end
function obj:GetDataSize() return self.data:len() end
function obj:SetData(d) self.data = d return true end

clip = wx.wxClipboard.Get()
print(clip:IsSupported(fmt), clip:GetData(obj))
--> true    false
print(obj.data)
--> "test"

I've doublechecked the contents of the clipboard and there is definitely 
data available.  I've also tried passing 1 and 13 (CF_TEXT and 
CF_UNICODETEXT) to wxDataFormat, with the same result.





------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to