[Gambas-user] How to read mouse wheel string

Benoît Minisini gambas at ...1...
Mon Apr 29 16:20:59 CEST 2013


Le 14/04/2013 00:37, Ru Vuott a écrit :
> Hello Bruce,
>
>
>
>>
>> (Just to clarify something about your actual problem. If
>> your user
>> highlights text in some external window and then clicks the
>> middle mouse
>> button over a gambas textarea, does the text appear?)
>>
>
> Yes, it does. No problem.
>
>
>>
>> You cannot get the highlighted text in gambas because the
>> highlighted
>> text is not in the desktop clipboard, it is only in the
>> X-"clipboard"-buffer.  qt4.clipboard only knows about
>> the desktop
>> clipboard.
>>
>> The solution will lie in getting the highlighted text into
>> the desktop
>> clipboard.
>>
> Ok. Thanks.
> I saw that simply by highlighting the text I cannot "transpose" the copy in gambas application.
>
> I saw if I have a text (e.g. "my text") in Gedit, and I copy it via ctrl+C or via Copy function of right button of the mouse, in Gambas console or TextArea I obtain this:
>
> GTKTEXTBUFFERCONTENTS-0001^@^@^@N <text_view_markup>
>   <tags>
>   </tags>
> <text>my text</text>
> </text_view_markup>
>
>
> But if I copy from LibreOffice (via ctrl+C or via Copy function of right button of the mouse) I obtain in Gambas application the "pure" text:
>
>    my text
>
>
> And more, if I copy a simple text from a web page, I obtain the entire HTML tag line where is the text. Every charapter is separated by the ASCII value of zero.
> ��<^@s^@p^@a^@n^@ ^@c^@l^@a^@s^@s^@=^@"^@m^@e^@d^@i^@u^@m^@"^@ ^@s^@t^@y^@l^@e^@=^@"^@l^@i^@n^@e^@-^@h^@e^@i^@g^@h^@t^@:^@1^@.^@2^@3^@1^@"^@>^@N^@e^@k^@ ^@h^@a^@ ^@r^@i^@v^@e^@l^@a^@t^@o^@<^@/^@s^@p^@a^@n^@>^@
>
>
> Regards
> vuott
>

First, there is two copy & paste buffers on X11: the one with CTRL+C, 
and the one with the middle mouse button.

I only implemented the first one at the moment, both in gb.qt4 and gb.gtk.

Last, a clipboard may "store" (not actually, but let's forget the 
details) the data in different formats. Clipboard.Paste() only gets the 
first one, which you cannot guess what it is.

Use the optional argument of Clipboard.Paste() to specify the format, 
and the Formats property to enumerate all formats stored in the clipboard.

Regards,

-- 
Benoît Minisini




More information about the User mailing list