Article View: comp.lang.pascal.borland
Article #450Re: ASCII Codes...
From: Frederic
Date: Wed, 16 Sep 1998 00:00
Date: Wed, 16 Sep 1998 00:00
37 lines
1624 bytes
1624 bytes
John Skilbeck wrote:
>
> I am having problems detecting whether a cursor key is pressed or certain
> capital letters within TP 7.0.
>
> For example, the UP arrow on the keyboard is ASCII code 0 72, 'H' is ASCII
> code 72.
>
> Is it possible to detect the difference between these keys in Pascal? If so,
> how??
>
> Any suggestions would be much appreciated.
>
> Thanks,
>
> John.
uses crt;
var
ch : char;
begin
ch := readkey;
case ch of
#0 : begin
ch := readkey;
case ch of
#72 : writeln('Up has been pressed');
#80 : writeln('Down has been pressed');
#77 : writeln('Right has been pressed');
#75 : writeln('Left has been pressed')
end
else
writeln('No cursor key pressed')
end
end.
This code has not been tested. But it should work.
Technical Details
Message-ID:
<35FFEAE5.84D7D201@primus-online.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6ton52$ip0$1@news3.cableinet.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 108ebd,6641efc813030989 X-Google-Attributes: gid108ebd,public X-Google-Thread: 111659,6641efc813030989 X-Google-Attributes: gid111659,public X-Google-Thread: 10cc59,6641efc813030989 X-Google-Attributes: gid10cc59,public From: Frederic <ebonroy@primus-online.de> Subject: Re: ASCII Codes... Date: 1998/09/16 Message-ID: <35FFEAE5.84D7D201@primus-online.de> X-Deja-AN: 391755857 Content-Transfer-Encoding: 7bit References: <6ton52$ip0$1@news3.cableinet.co.uk> X-Accept-Language: fr-FR,de-DE Content-Type: text/plain; charset=us-ascii Organization: Primus Online GmbH Mime-Version: 1.0 Newsgroups: comp.lang.pascal.borland,comp.lang.pascal,borland.public.turbopascal