Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Windows Tk issue Copy and Paste Russian keyboard

by IB2017 (Pilgrim)
on May 20, 2019 at 07:43 UTC ( [id://11100270]=note: print w/replies, xml ) Need Help??


in reply to Re: Windows Tk issue Copy and Paste Russian keyboard
in thread Windows Tk issue Copy and Paste Russian keyboard

Hello Anonymous. No code this time, as Copy and Paste works in Tk out-of-the-box on Windows (and on macOS too), so I do not normally need to handle it specifically. I admit I do not know how it works behind the scenes (but I would like to get info about it). I just noted that it "simply works" on any layout I tried, except Russian (there may be others though). And my Russian users have told me that the standard shortkeys should be the usual ones (ctrl+C/V).

Replies are listed 'Best First'.
Re^3: Windows Tk issue Copy and Paste Russian keyboard
by choroba (Cardinal) on May 20, 2019 at 11:25 UTC
    How do you type Ctrl+C and Ctrl+V on a Russian keyboard? Are they Ctrl+Ц and Ctrl+В?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      I am a bit confused. In all applications I have tried (Browser for example) I can switch keyboard layout and use Ctrl-C/V (I mean the same physical keys, not the value mapped to it) and copy and paste continues to work (I have tried with Russian, Greek, Chinese and so on). In a Tk Widget, this is not true anymore (Russian and Greek do not work anymore). As far as my (Russian) colleagues have reported that Russian copy and paste should work on Windows using the same (physical) keys we are accustomed to.

      If things are like this and this is not a bug, doeas it mean I need to add a bind to map a particular shortcut to copy/paste? This will a) need me to know the current keyboard layout (as far as I know there is no way to get it programmatically) b) code a way to perform the copy/paste operation. This sounds like quite a lot of job to have copy and paste on other layouts then Latin keyboards. Am I overseeing something?

        I'm not in a position to test this, but the internet suggests that Tk can also bind to a keycode, not only a character, but the solutions seem to be to bind to all keys using KeyPress and then to look at the keycode in the event.

      The keyboards have both layouts printed on them (otherwise it's a pain to use: imagine trying to access Perlmonks while only being able to type Cyrillic), and you just press the keys corresponding to Latin C and V, no matter which keyboard layout is active. With the most popular Cyrillic layout (that is, ЙЦУКЕН, not phonetic ЯВЕРТЫ), C corresponds to С (U+0421 CYRILLIC CAPITAL LETTER ES) and V corresponds to М (U+041C CYRILLIC CAPITAL LETTER EM).
        Probably depends on the decision, wether to interpret scancodes (key positions) or characters (key meanings). In this case it's characters, and the russian layout doesn't have a C (Latin-Letter-Cee), so you can't enter Control-C, only Control-Cyrillic-Letter-Es, which leads to OP's situation.

        Thank you for the explanation: "you just press the keys corresponding to Latin C and V, no matter which keyboard layout is active" and this is exactly what is not working in Tk (while it works virtually in any other application I tried).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11100270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-28 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found