• Windows: Bind to keys accessible via AltGr

    From Torsten@Torsten@example.com to comp.lang.tcl on Mon Jan 12 15:04:54 2026
    From Newsgroup: comp.lang.tcl

    I have a German QWERTZ keyboard. In my application I bind scripts to keys accessible via AltGr, e.g.
    | (bar), \ (backslash), @ (at) etc. This works under Linux and macOS, but not under Windows.
    It even works under Linux, which runs in a VirtualBox on this Windows system.

    Why are the bindings not working under Windows?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Jan 12 15:21:02 2026
    From Newsgroup: comp.lang.tcl

    Am 12.01.2026 um 15:04 schrieb Torsten:
    I have a German QWERTZ keyboard. In my application I bind scripts to
    keys accessible via AltGr, e.g. | (bar), \ (backslash), @ (at) etc. This works under Linux and macOS, but not under Windows.
    It even works under Linux, which runs in a VirtualBox on this Windows system.

    Why are the bindings not working under Windows?

    I suppose, you have to bind to Ctrl+Alt+q for "@"

    Why etc, no idea, sorry...

    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Paul Obermeier@obermeier@poSoft.de to comp.lang.tcl on Mon Jan 12 15:24:05 2026
    From Newsgroup: comp.lang.tcl

    Am 12.01.2026 um 15:04 schrieb Torsten:
    I have a German QWERTZ keyboard. In my application I bind scripts to keys accessible via AltGr, e.g. | (bar), \ (backslash), @ (at) etc. This works under Linux and macOS, but not under Windows.
    It even works under Linux, which runs in a VirtualBox on this Windows system.

    Why are the bindings not working under Windows?

    Can confirm the behaviour of Torsten on German keyboards.

    Execute the following simple script:

    package require Tk
    catch { console show }
    ttk::label .b -text "Press any key to see keycode and keysym"
    pack .b
    bind . <Any-Key> [list puts "%k %K"]

    Then typing "<" and "|" gives the following output:

    Linux Tcl 8.6.17:
    94 less
    108 ISO_Level3_Shift
    94 bar

    Linux Tcl 9.0.3:
    94 <
    108 ISO_Level3_Shift
    94 |

    Windows Tcl 8.6.17:
    226 less
    17 Control_L
    18 Alt_R
    226 less

    Windows Tcl 9.0.3:
    226 <
    17 Control_L
    18 Alt_R
    226 <

    Also note, that the print-out of the keysyms is different on 8.6.17 and 9.0.3. Is this an intended change?

    Paul

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Mon Jan 12 13:02:33 2026
    From Newsgroup: comp.lang.tcl

    On 1/12/2026 9:24 AM, Paul Obermeier wrote:

    Execute the following simple script:

    package require Tk
    catch { console show }
    ttk::label .b -text "Press any key to see keycode and keysym"
    pack .b
    bind . <Any-Key> [list puts "%k %K"]

    Then typing "<" and "|" gives the following output:

    Linux Tcl 8.6.17:
    94 less
    108 ISO_Level3_Shift
    94 bar

    Linux Tcl 9.0.3:
    94 <
    108 ISO_Level3_Shift
    94 |

    Windows Tcl 8.6.17:
    226 less
    17 Control_L
    18 Alt_R
    226 less

    Windows Tcl 9.0.3:
    226 <
    17 Control_L
    18 Alt_R
    226 <



    And on Windows Tcl 8.6.16 with a US keyboard:

    For "<":

    16 Shift_L
    188 less



    For "|":

    16 Shift_L
    220 bar



    Why so much variation? How can one convert code using these bindings to
    be multilingual?



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Rolf Ade@rolf@pointsman.de to comp.lang.tcl on Mon Jan 12 23:17:53 2026
    From Newsgroup: comp.lang.tcl


    Paul Obermeier <obermeier@poSoft.de> writes:
    Am 12.01.2026 um 15:04 schrieb Torsten:
    I have a German QWERTZ keyboard. In my application I bind scripts to keys accessible via AltGr, e.g. | (bar), \ (backslash), @ (at) etc. This works under Linux and macOS, but not under Windows.
    It even works under Linux, which runs in a VirtualBox on this Windows system.
    Why are the bindings not working under Windows?

    Can confirm the behaviour of Torsten on German keyboards.

    Execute the following simple script:

    package require Tk
    catch { console show }
    ttk::label .b -text "Press any key to see keycode and keysym"
    pack .b
    bind . <Any-Key> [list puts "%k %K"]

    Then typing "<" and "|" gives the following output:

    Linux Tcl 8.6.17:
    94 less
    108 ISO_Level3_Shift
    94 bar

    Linux Tcl 9.0.3:
    94 <

    ^^^^^^^

    108 ISO_Level3_Shift
    94 |

    Windows Tcl 8.6.17:
    226 less
    17 Control_L
    18 Alt_R
    226 less

    Windows Tcl 9.0.3:
    226 <

    ^^^^^^^^

    Which is a partiuclary bad reply because "<" is not allowed as
    sequence in a bind command (as the documentation in fact mentions):

    bind . <<> {puts fired}
    virtual event "<<>>" is badly formed

    Just as bad with ">". Reported as > by %K with 9.0.3.

    bind . <>> {puts fired}
    no event type or button # or keysym

    rolf
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Mon Jan 12 21:20:51 2026
    From Newsgroup: comp.lang.tcl

    On 1/12/2026 5:17 PM, Rolf Ade wrote:

    Paul Obermeier <obermeier@poSoft.de> writes:
    Am 12.01.2026 um 15:04 schrieb Torsten:


    ^^^^^^^^

    Which is a partiuclary bad reply because "<" is not allowed as
    sequence in a bind command (as the documentation in fact mentions):

    bind . <<> {puts fired}
    virtual event "<<>>" is badly formed

    Just as bad with ">". Reported as > by %K with 9.0.3.

    bind . <>> {puts fired}
    no event type or button # or keysym


    I wonder why that doesn't cause a syntax error of some sort. I thought
    you'd have to use "<Key-xyz>" for bindings like this.

    Here is an implementation which does work as intended:

    package req Tk
    bind . <Key-<> [list puts "LESS THAN: %k :: %K"]
    bind . <Key->> [list puts "GREATER THAN: %k :: %K"]


    # Sample output:
    LESS THAN: 188 :: less
    GREATER THAN: 190 :: greater
    LESS THAN: 188 :: less
    LESS THAN: 188 :: less
    GREATER THAN: 190 :: greater
    LESS THAN: 188 :: less
    GREATER THAN: 190 :: greater
    GREATER THAN: 190 :: greater
    LESS THAN: 188 :: less

    --- Synchronet 3.21a-Linux NewsLink 1.2