[Fxruby-users] Re: Clipboard example
Status: Inactive
Brought to you by:
lyle
|
From: Lyle J. <ly...@kn...> - 2003-10-16 02:08:21
|
Dalibor Sramek wrote:
> Could it be something similar to the LF/CRLF UNIX/Windows difference?
Not that, but a platform dependency nonetheless ;)
It turns out that for Windows, string data placed on the clipboard in
the standard format must end with a null terminator. In other words, for
a string like "foo" we actually want to store 4 bytes (where the last
byte is zero). In contrast, X expects just the string data without the
null terminator (e.g. just 3 bytes for "foo").
So a workaround for that previous example I sent you is to replace this
line in the SEL_CLIPBOARD_REQUEST handler:
@treelist.setDNDData(FROM_CLIPBOARD
FXWindow.stringType,
currentItemText)
with something like:
if /mswin/ =~ PLATFORM
@treelist.setDNDData(FROM_CLIPBOARD
FXWindow.stringType,
currentItemText + "\0")
else
@treelist.setDNDData(FROM_CLIPBOARD
FXWindow.stringType,
currentItemText)
end
but I will try to come up with a more palatable solution for the next
release. Maybe the best thing is to add a pair of module methods, like
the existing fxencodeColorData() and fxdecodeColorData(), for working
with strings going to or coming from the clipboard.
Hope this helps,
Lyle
|