Help on Arrow Keys--Handy tool for all keys 
Author Message
 Help on Arrow Keys--Handy tool for all keys

There continue to be questions about different function keys and how
to read them in this newsgroup. Here is a program written last year
for a similar request. In the Turbo editor, you can load two programs
at once and switch back and forth between them. This program makes a
useful tool that you can use when writing interactive programs such
as menus, games, etc where you want the input to be key strokes. It is
also useful when a Chr( ) is needed and you don't remember the number.


Program Key_Identity;
{ Clif Penn Nov 23, 1995--(updated Feb 8, 1996) , Turbo v 6.0
Handy for finding key values of both standard and special function
keys. You can load this while editing another program and flip back
and forth faster than you can find the right page in a manual.
Function keys, arrows etc are two-in-one char keys, (the first char is
null, #0).  }

Uses CRT;

Var Ch, Confirm : Char;

Confirm := 'N';
Writeln('****Confirm QUIT after pressing Escape****');
      Writeln;     Write('Press any key: ');
      Ch := ReadKey;    Writeln(Ch);
      If Ch <> #0 Then  {it's not a special function key}
              Case Ch of
                   #8 : Write('Backspace');
                   #9 : Write('Forward Tab');
                  #13 : Write('Enter');
                  #27 : Write('Escape');
                  #32 : Write('Space');
                  Else  Write(Ch);
              End;  (* case *)
              Writeln(' = ASCII ', ord(Ch));
          End  (* if *)
       Else    {it's a special function key}
               Ch := ReadKey;  (* char after null *);
               Write('Special key = #', ord(Ch));
               Case Ch of
                    #72 : WriteLn(', Up Arrow.');
                    #80 : WriteLn(', Down Arrow.');
                    #77 : Writeln(', Right Arrow.');
                    #75 : Writeln(', Left Arrow.');
                    Else  Writeln;
               End;  (* case *)
          End; (* if-then-else *)

If Ch = #27 Then  (* Escape *)
        Write('Do you really want to quit (Y/N)? ');
        Confirm := ReadKey;
UNTIL UpCase(Confirm) = 'Y' ;

Wed, 18 Jun 1902 08:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Help me on my MS Quick Pascal (Arrow keys)

2. Help : How to make use of arrow Keys in Pascal

3. Arrow keys

4. Move sprite with arrow keys.

5. arrow keys.

6. Arrow Key

7. arrows keys

8. about keyboard arrows and functions keys

9. How to read arrow keys from the keyboard?

10. How to read arrow keys from the keyboard?

11. How to read arrow keys from the keyboard?

12. How to use Arrow Keys...


Powered by phpBB® Forum Software