[wxruby-users] Filling clipboard doesn't work

Alex Fenton alex at pressure.to
Sat Aug 16 10:00:33 EDT 2008


Niklas Baumstark wrote:
> Alex Fenton <alex at pressure.to> wrote:
>   
>> Does it help to paste to other applications if you add
>>
>>   clip.use_primary_selection
>>
>> here?
>>     
>
> unfortunately it does not.
>   

OK. Thanks for trying anyway.

>> 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 doesn't work either, this prints out my old clipboard content (before running the app).
> is there a way i can help finding the source of this problem?
You could try adding Wx::Log.add_trace_mask('clipboard') before the 
Clipboard operations. This may give you some more debugging output. But 
I tried this already and it all looks in order - the formats are matched 
etc. It's announcing that STRING_UTF8 and STRING data are available 
which is correct. Let me know if you see something different.

I spent a few hours trying this under gdb and comparing to the wxWidgets 
dnd sample. My hunch is that it's something to do with the way the C++ 
classes are mapped onto Ruby. wxWidgets uses a pretty complex structure 
of virtual methods in DataObject* that are hard to translate. For 
example TextDataObject#get_data_size always seems to report 0 in wxRuby, 
which seems wrong.

I'll keep looking into it
cheers
alex







More information about the wxruby-users mailing list