[wxruby-users] Filling clipboard doesn't work
Alex Fenton
alex at pressure.to
Fri Aug 15 13:39:21 EDT 2008
Alex Fenton wrote:
> Niklas Baumstark wrote:
>> I ran into a bit of trouble with my first wxRuby application. I'm using
>> ruby 1.8.6 with wxRuby 1.9.7 on x86 Linux (Ubuntu). Didn't test any
>> other platform yet. In my application, I'm trying to access the
>> clipboard like this:
>>
>> Wx::Clipboard.open do |clip|
Does it help to paste to other applications if you add
clip.use_primary_selection
here? Looking at the wxWidgets drag'n'drop sample, this is needed under
X to share with other applications.
>> clip.set_data Wx::TextDataObject.new("TEST")
>> clip.flush
>> end
>>
>> This doesn't work. While running the app (after the execution of the
>> above code), the menu entry "Paste" is enabled in other applications,
>> but nothing is in the clipboard (at least nothing happens on pasting).
>> After quitting my application, the menu entry is disabled again and the
>> clipboard is empty.
>>
It might be worth checking if the data is at least available within your
own application. After doing the set_data, trying retrieving it with
something like
Wx::Clipboard.open do | clip |
data = Wx::TextDataObject.new
clip.get_data(data)
p data.get_text
end
> This code works fine for me on OS X; both while the app is running and
> after it's ended the text data is available to other apps via Paste,
> .I'll try it out on Ubuntu later.
I tried it out on Ubuntu and unfortunately I can confirm that neither
within-application or inter-application copying via the Clipboard is
working for me. However I'm using Ubuntu within a VirtualBox VM at the
moment and this has some clipboard integration with the host OS - so I'd
like to this out as the source of the problem.
thanks
alex
More information about the wxruby-users
mailing list