Board index » delphi » Help. How to use Extended Key Codes?

Help. How to use Extended Key Codes?

Here's what I use to read extended scan codes:

var ch: char;

begin
  Repeat
    if keypressed
      then ch := readkey;
    if ch = (0) and keypressed
      then ch := readkey;
    case ch of
      #49: menu
    end;
  until ch = #27   {until ch = 'Esc' }
end;

The key (no pun intended) to using some thing like this is that this section
of the code becomes event driven in a limited sence.  If you want this to
happen at ANY time, you need to build that whole application that way.  The
most common way to do that is using the TurboVision or the Windows stuff.

Hope that helps.

In article <4e5uef$754_...@salford.ac.uk>, t.p.ban...@mcs.salford.ac.uk
says...

Quote

>How do you use Extended key codes in Borland Turbo Pascal7, on a
>Uni network computer.  I'm trying to use the key combo   Alt n    
>which has the extended key code of 49.  But all I can find out from
>my book is 'Extended Key Codes (always preceded by chr(0))'

>How do you read it?  Do you use read, readln, readkey or whatever?
>What should the variable be ie char, integer?
>Doesn't really matter about this question.  Is there an easy method
>so that no mater where you press  alt n the program will execute a
>procedure (ie bring up a menu)?

>Thanks in advance

>Tim

>(I would be extreemly grateful for any replies sent to me today as
>I'm trying to finish my Pascal project.  But if not today any time
>will do).

--
Views expressed herein are not necessarily the views
of Ontrack Computer Systems, Inc. or Ontrack Data Recovery, Inc.
*******************************************************************
* Ken Stieers               |  Minneapolis - 1.800.872.2599       *
* AV Research/Apps. Eng.    |  Los Angeles - 1.800.752.7557       *
* Ontrack Computer Systems  |  Washington, D.C. - 1.800.650.2410  *
* Ontrack Data Recovery     |  London - 0800 24 39 96             *
* Eden Prarie, MN           |  Japan - 81.429.32-6365             *
*******************************************************************
 

Re:Help. How to use Extended Key Codes?


How do you use Extended key codes in Borland Turbo Pascal7, on a
Uni network computer.  I'm trying to use the key combo   Alt n    
which has the extended key code of 49.  But all I can find out from
my book is 'Extended Key Codes (always preceded by chr(0))'

How do you read it?  Do you use read, readln, readkey or whatever?
What should the variable be ie char, integer?
Doesn't really matter about this question.  Is there an easy method
so that no mater where you press  alt n the program will execute a
procedure (ie bring up a menu)?

Thanks in advance

Tim

(I would be extreemly grateful for any replies sent to me today as
I'm trying to finish my Pascal project.  But if not today any time
will do).

Re:Help. How to use Extended Key Codes?


In article <4e5uef$754_...@salford.ac.uk>,
   t.p.ban...@mcs.salford.ac.uk (Tim Banner) wrote:

Quote
>How do you use Extended key codes in Borland Turbo Pascal7, on a
>Uni network computer.  I'm trying to use the key combo   Alt n    
>which has the extended key code of 49.  But all I can find out from
>my book is 'Extended Key Codes (always preceded by chr(0))'

>How do you read it?  Do you use read, readln, readkey or whatever?
>What should the variable be ie char, integer?
>Doesn't really matter about this question.  Is there an easy method
>so that no mater where you press  alt n the program will execute a
>procedure (ie bring up a menu)?

>Thanks in advance

>Tim

>(I would be extreemly grateful for any replies sent to me today as
>I'm trying to finish my Pascal project.  But if not today any time
>will do).

You can get the answer from my FAQs, http://www.glink.net.hk/~wk/wkpasfaq.htm

                                                Regards,
                                                William of HKTC.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Fastest return e-mail : w...@glink.net.hk>
<Second return e-mail  : Lee.Wing.Kin.Will...@mccatholic.yonet.org>

William is a student of Hong Kong Technical College (Tsing Yi),
he is studying Higher Diploma in Software Engineering.

Other Threads