• How to feed special keys to text widget programmatically?

    From Helmut Giese@21:1/5 to All on Tue May 31 16:31:55 2022
    Hello out there,
    I am writing a test program for a text widget and came across the
    problem to test its behaviour wrt special keys (ctrl, up, down, etc.).
    I have no idea how to feed those into my widget.
    Any help or advice will be greatly appreciated.
    Best regards
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Heller@21:1/5 to [email protected] on Tue May 31 10:57:48 2022
    What do you mean by feed?

    The keys you list (ctrl, up, down) are either modifiers or else have special bindings (eg movement). The Control modifier key when applied to regular keys has special bindings (like movement or some other function, like Copy or Paste). What exactly are you trying to test?

    There is a file in the Tk library (on my Ubuntu system is is in /usr/share/tcltk/tk8.6/) named text.tcl which contains all of the default bindings for the text widget, along with the helper functions that they use.

    At Tue, 31 May 2022 16:31:55 +0200 Helmut Giese <[email protected]> wrote:


    Hello out there,
    I am writing a test program for a text widget and came across the
    problem to test its behaviour wrt special keys (ctrl, up, down, etc.).
    I have no idea how to feed those into my widget.
    Any help or advice will be greatly appreciated.
    Best regards
    Helmut



    --
    Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
    Deepwoods Software -- Custom Software Services
    http://www.deepsoft.com/ -- Linux Administration Services
    [email protected] -- Webhosting Services

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerald Lester@21:1/5 to Robert Heller on Tue May 31 12:14:52 2022
    On 5/31/22 10:57, Robert Heller wrote:
    What do you mean by feed?

    I think he is looking for the [event generate] command.


    The keys you list (ctrl, up, down) are either modifiers or else have special bindings (eg movement). The Control modifier key when applied to regular keys
    has special bindings (like movement or some other function, like Copy or Paste). What exactly are you trying to test?

    There is a file in the Tk library (on my Ubuntu system is is in /usr/share/tcltk/tk8.6/) named text.tcl which contains all of the default bindings for the text widget, along with the helper functions that they use.

    At Tue, 31 May 2022 16:31:55 +0200 Helmut Giese <[email protected]> wrote:


    Hello out there,
    I am writing a test program for a text widget and came across the
    problem to test its behaviour wrt special keys (ctrl, up, down, etc.).
    I have no idea how to feed those into my widget.
    Any help or advice will be greatly appreciated.
    Best regards
    Helmut





    --
    +----------------------------------------------------------------------+
    | Gerald W. Lester, President, KNG Consulting LLC |
    | Email: [email protected] | +----------------------------------------------------------------------+

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Helmut Giese on Tue May 31 16:29:38 2022
    Helmut Giese <[email protected]> wrote:
    Hello out there,
    I am writing a test program for a text widget and came across the
    problem to test its behaviour wrt special keys (ctrl, up, down, etc.).
    I have no idea how to feed those into my widget.
    Any help or advice will be greatly appreciated.

    Perhaps via "event generate"?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Giese@21:1/5 to Gerald Lester on Tue May 31 21:10:47 2022
    Gerald Lester <[email protected]> schrieb:

    On 5/31/22 10:57, Robert Heller wrote:
    What do you mean by feed?

    I think he is looking for the [event generate] command.

    but I didn't know it :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Giese@21:1/5 to Rich on Tue May 31 21:16:01 2022
    Rich <[email protected]d> schrieb:

    Helmut Giese <[email protected]> wrote:
    Hello out there,
    I am writing a test program for a text widget and came across the
    problem to test its behaviour wrt special keys (ctrl, up, down, etc.).
    I have no idea how to feed those into my widget.
    Any help or advice will be greatly appreciated.

    Perhaps via "event generate"?

    Hello Rich,
    yes, this seems to make it. It is a bit unfortunate that (from the
    manual): Certain events, such as key events, require that the window
    has focus to receive the event properly.
    But with a bit of juggling with 'after' I think I will get it to work.
    Many thanks to all who responded.
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)