How to find exactly which key is pressed? 
Author Message
 How to find exactly which key is pressed?

Hi!

In Windows environment (and *IX also i guess) it's programatically possible to find out exactly which key on the keyboard that is pressed. But I haven't found out how to do that in Tcl. For example, I can't figure out how to distinguish between the left and right control keys, the figure keys (0-9) above the letterkeys and keypad figure keys.

Anybody who knows?

Ingemar

--

Ingemar Hansson, Ericsson Mobile Communications AB
Lund, SWEDEN



Mon, 14 Jan 2002 03:00:00 GMT  
 How to find exactly which key is pressed?

Quote:

> In Windows environment (and *IX also i guess) it's programatically possible to find out exactly which key on the keyboard that is pressed. But I haven't found out how to do that in Tcl. For example, I can't figure out how to distinguish between the left and right control keys, the figure keys (0-9) above the letterkeys and keypad figure keys.

# let $w be your widget, say "."

bind  $w <KeyPress> {puts {%%K=%K %%A=%A}}

#instead of puts, you might show the keysym (K) and the printable char
(A) in a label, or whatever.

--
Schoene Gruesse/best regards, Richard Suchenwirth - tel. +49-7531-86
2703
RC DT2, Siemens Electrocom GmbH, Buecklestr. 1-5, D-78467 Konstanz,
Germany
Meet me at: http://purl.org/thecliff/tcl/wiki//Richard*Suchenwirth , or
(purl.org not found?) http://mini.net/cgi-bin/wikit/Richard*Suchenwirth



Mon, 14 Jan 2002 03:00:00 GMT  
 How to find exactly which key is pressed?

Quote:


> > In Windows environment (and *IX also i guess) it's programatically possible to find out exactly which key on the keyboard that is pressed. But I haven't found out how to do that in Tcl. For example, I can't figure out how to distinguish between the left and right control keys, the figure keys (0-9) above the letterkeys and keypad figure keys.

> # let $w be your widget, say "."

> bind  $w <KeyPress> {puts {%%K=%K %%A=%A}}

> #instead of puts, you might show the keysym (K) and the printable char
> (A) in a label, or whatever.

Yes, that works great with plain characters. But what do you get when you press left and right Ctrl keys? On my system both Ctrl keys prints Control_L.

Ingemar



Mon, 14 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to find when the enter key pressed in a memo

2. How to capture key-presses (keyboard-presses)???

3. not exactly a 3-key keyboard ...

4. I am trying to find an equivalency to the global boolean found in labview 2

5. IBM VA close window upon key pressed event

6. Tracking key presses, mouse clicks and mouse movements?

7. many keys pressed at the same time

8. Command-key presses

9. Changing the cursor when control key pressed.

10. Key press events on a window

11. Selecting TAB sheet by pressing TAB key

12. Keycode() - Getting a response to a key press

 

 
Powered by phpBB® Forum Software