home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!mcsun!fuug!pcuf!news
- From: basse@pcuf.fi (Basse Salmela)
- Subject: Re: Cursor and F1-F12 keys under Turbo-Pascal
- Message-ID: <C0GEC9.62q@pcuf.fi>
- Sender: news@pcuf.fi (News)
- Nntp-Posting-Host: pcuf.fi
- Organization: The PC-users of Finland
- References: <1993Jan4.134821.325@sinus.stgt.sub.org>
- Date: Wed, 6 Jan 1993 22:26:32 GMT
- Lines: 33
-
- You wanted to know how to use function and cursor keys in your Pascal
- programs.
-
- When reading cursor keys, and function keys, you have to read character
- twice. In first time when key is pressed the return is character #0, after
- that comes second character, example #59 which is F1.
- Maybe a little example makes it easier to understand.
-
- Ch := ReadKey;
- If Ch = #0 then Begin
- Ch := ReadKey;
- Case Ch of
- #59 : F1Pressed;
- #60 : F2Pressed;
- End;
- End;
-
- There, in first 'ch := readkey' program asks user to press any key, and
- if it was #0 then it reads the second char what comes automaticly after
- #0 and then comes that Case loop..
-
- Finding out these combinations you should do a program which shows every
- key code you press. Something like this:
-
- Repeat
- Ch := ReadKey;
- WriteLn('Key was: ', Ord(Ch));
- Until Ch = #27;
-
-
- Hope this helped in some way...
-
- Best regards, BaSSe
-