🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #453

Re: ASCII Codes...

#453
From: Mike Copeland
Date: Wed, 16 Sep 1998 00:00
29 lines
1565 bytes
> 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??

   Yes, and your code is no doubt omitting the process of the 
Extended/Special keys (and their scan codes).  The situation you're 
seeing is due to "H" and the scan code for UpArrow being the same value.  
Here's what you must do:

Var C1 : char;
...
  C1 := UpCase(ReadKey);
  case C1 of
   #00 : begin  { Extended/Special keystroke }
           case ReadKey of  { process the scan code }
            #72 : do_UpArrow;
            etc.
            else
           end  { case }
          end;
    #72 : do_H;
    etc.
   else
   end
Technical Details
Message-ID: <MPG.1069952d4ffe5034989a0b@news.primenet.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6ton52$ip0$1@news3.cableinet.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111659,6641efc813030989
X-Google-Attributes: gid111659,public
X-Google-Thread: 10cc59,6641efc813030989
X-Google-Attributes: gid10cc59,public
X-Google-Thread: 108ebd,6641efc813030989
X-Google-Attributes: gid108ebd,public
From: mrcope@primenet.com (Mike Copeland)
Subject: Re: ASCII Codes...
Date: 1998/09/16
Message-ID: <MPG.1069952d4ffe5034989a0b@news.primenet.com>
X-Deja-AN: 391877285
References: <6ton52$ip0$1@news3.cableinet.co.uk>
X-Complaints-To: abuse@globalcenter.net
Organization: Copeland Computer Services
X-Posted-By: @206.165.23.78 (mrcope)
Newsgroups: comp.lang.pascal.borland,comp.lang.pascal,borland.public.turbopascal