Hi all,
I'm working on passing formatted text through the Clipboard between the
RichTextCtrl and other programs.
On Windows, it's easy enough. I create a Custom Data Format using:
wx.CustomDataFormat('Rich Text Format')
and I can use this to pass Rich Text Format strings between my program and
Word using my PyRTFParser. I've got it working great on Windows and will be
sharing the code as soon as I get a couple of problems cleared up, probably
in the next couple of days.
But this approach doesn't work on OS X. Well, it works between my
RichTextCtrl-derived control and my RichTextCtrl-derived control, but it
doesn't work between my control and other programs like Word for OS X or
TextEdit. They don't seem to use the "Rich Text Format" custom data string
on OS X like they do on Windows. (That would just be too easy.)
I admit, I lucked into finding the right process on Windows, and my
Google-fu has failed me for OS X.
I see two ways to proceed from here.
One possibility is that I just need the right wx.CustomDataFormat string.
Does anyone know what wx.CustomDataFormat would let me transfer RTF data
through the Clipboard on OS X?
The second possibility is that I can figure it out if I can just query the
Clipboard correctly. Does anyone know how I can ask the Clipboard what data
formats it knows? I can't find any appropriate methods in the
wx.TheClipboard object or in any of the wx.DataFormat and wx.DataObject
objects I've looked at. I hope I'm just being thick and am missing
something obvious. wx.TheClipboard.IsSupported() requires a KNOWN format,
and says my custom data format isn't supported unless I populated the
Clipboard from one of my own controls on OS X. If the Clipboard can just
tell me what data formats it contains, I can figure out which one has RTF
data in it, but I can't figure out how to ask the clipboard that question.
Any suggestions or hints would be greatly appreciated. Thanks in advance,
David K. Woods, Ph.D.
Researcher, Transana Lead Developer
Wisconsin Center for Education Research
University of Wisconsin, Madison
http://www.transana.org