Computer Science Canada

What are the names for the keys?

Author:  skatelhs [ Thu May 22, 2003 6:23 pm ]
Post subject:  What are the names for the keys?

I'm wondering, how do you find out the names for keys?
for example KEY_DOWN_ARROW and KEY_ENTER, but what are they for
a b c d e f g etc.
or is that just something like
if (variable name):"c" then
put whatever

thanks

Author:  Tony [ Thu May 22, 2003 6:30 pm ]
Post subject: 

moved to turing help

as for the other letters...

code:
var chars : array char of boolean
        Input.KeyDown (chars)
        if chars ('t') then
            put "The T key is pressed"
        end if


just use the letter itself... 'a','b','c'...

Author:  nate [ Thu May 22, 2003 6:30 pm ]
Post subject:  ?

for a = ('a')
for b = ('b')

ect.

i hope u get the picture
\
-NAte

Author:  kythoon [ Thu May 22, 2003 6:33 pm ]
Post subject: 

search for key codes

look at document title

Author:  Kingnoz [ Fri May 23, 2003 5:21 pm ]
Post subject: 

***This is a great program to run that shows about all the keys on the keyboard.***

i was given it from school

code:

% The "KeyDown1" program.

% Note that depending on the keyboard's hardware, there may be a maximum
% of two keys + Shift + Control + Alt detectable at any one time.  This
% should be remembered in multiplayer games where one player holding down
% two keys could prevent another player's keys from being detected.

% Note that many ASCII values are never generated.  Shift+A produces
% two characters: lower case a and Shift.

% The list of keys and their associated characters starting the characters
% with no visible representation.
var keys : array 0 .. * of
    record
        character : char
        name : string
    end record := init (
    init (chr (27), "Escape key"),
    init (chr (187), "F1 key"),
    init (chr (188), "F2 key"),
    init (chr (189), "F3 key"),
    init (chr (190), "F4 key"),
    init (chr (191), "F5 key"),
    init (chr (192), "F6 key"),
    init (chr (193), "F7 key"),
    init (chr (194), "F8 key"),
    init (chr (195), "F9 key"),
    init (chr (196), "F10 key"),
    init (chr (133), "F11 key"),
    init (chr (134), "F12 key"),
    init (chr (10), "Enter key"),
    init (chr (180), "Shift key"),
    init (chr (181), "Control key"),
    init (chr (182), "Alt key"),
    init (chr (8), "Backspace key"),
    init (chr (9), "Tab key"),
    init (chr (203), "Left Arrow"),
    init (chr (200), "Up Arrow"),
    init (chr (205), "Right Arrow"),
    init (chr (208), "Down Arrow"),
    init (chr (199), "Home"),
    init (chr (201), "Page Up"),
    init (chr (207), "End"),
    init (chr (209), "Page Down"),
    init (chr (210), "Insert"),
    init (chr (211), "Delete"),
    init (chr (183), "Keypad 5"),

    init ('`', "Left apostrophe key"),
    init ('1', "1 key"),
    init ('2', "2 key"),
    init ('3', "3 key"),
    init ('4', "4 key"),
    init ('5', "5 key"),
    init ('6', "6 key"),
    init ('7', "7 key"),
    init ('8', "8 key"),
    init ('9', "9 key"),
    init ('0', "0 key"),
    init ('-', "- key"),
    init ('=', "= key"),
    init ('a', "a key"),
    init ('b', "b key"),
    init ('c', "c key"),
    init ('d', "d key"),
    init ('e', "e key"),
    init ('f', "f key"),
    init ('g', "g key"),
    init ('h', "h key"),
    init ('i', "i key"),
    init ('j', "j key"),
    init ('k', "k key"),
    init ('l', "l key"),
    init ('m', "m key"),
    init ('n', "n key"),
    init ('o', "o key"),
    init ('p', "p key"),
    init ('q', "q key"),
    init ('r', "r key"),
    init ('s', "s key"),
    init ('t', "t key"),
    init ('u', "u key"),
    init ('v', "v key"),
    init ('w', "w key"),
    init ('x', "x key"),
    init ('y', "y key"),
    init ('z', "z key"),
    init ('[', "[ key"),
    init (']', "] key"),
    init ('\\', "\\ key"),
    init (';', "; key"),
    init ('\'', "' key"),
    init (',', ", key"),
    init ('.', ". key"),
    init ('/', "/ key"),
    init (' ', "Space key"),
    init ('*', "* key (Keypad)"),
    init ('+', "+ key (Keypad)")
    )
var a : array char of boolean
setscreen ("noecho")
loop
    Input.KeyDown (a)

    locate (1, 1)
    for key : 0 .. upper (keys)
        if a (keys (key).character) then
            put ord (keys (key).character), ": ", keys (key).name, "  " ..
        end if
    end for
    put ""
end loop
[/quote]

Author:  naoki [ Fri May 23, 2003 8:15 pm ]
Post subject: 

if you have turing 4.0+ you can press f10, then click on the link that says "getch key codes" or something like that. handy dandy, much easier than running a program

Author:  Kingnoz [ Fri May 23, 2003 9:18 pm ]
Post subject: 

oh well. i find it easier to find the number in the program Laughing


: