Reading F11-F12, Numeric-5 keys in TP7 
Author Message
 Reading F11-F12, Numeric-5 keys in TP7

Hi,
Simple question: How to read F11-F12 keys and "5" key on numeric pad in
TP7?

Remember SIDEKICK uses "5" key on numeric pad to activate.

Thanx



Wed, 18 Jun 1902 08:00:00 GMT  
 Reading F11-F12, Numeric-5 keys in TP7

Quote:
>Hi,
>Simple question: How to read F11-F12 keys and "5" key on numeric pad in
>TP7?

Use Int $16, subfunctions $10 [read the key] or $11 [key in buffer aka
KeyPressed] to get extended keystrokes. Note that these return both
codes together in AX instead of the two separate calls to CRT.ReadKey
needed if the first call returns #0.

Alternative: my replacement CRT unit handles extended keycodes using
ReadKey and KeyPressed if the computer contains a BIOS that will handle
extended keystrokes. Found via <URL: http://www.pedt.demon.co.uk/crt/>

--
Information on Newsgroup posted weekly on Sunday - read before writing!
Contains links to    |  http://homepages.force9.net/Pascal/faq/
helpful information  |  http://www.merlyn.demon.co.uk/clpb-faq.txt
and some guidelines  |  ftp://garbo.uwasa.fi/pc/doc-net/faqclpb.zip



Wed, 18 Jun 1902 08:00:00 GMT  
 Reading F11-F12, Numeric-5 keys in TP7


Quote:
>Hi,
>Simple question: How to read F11-F12 keys and "5" key on numeric pad in
>TP7?

Unit F1112;

interface

var extended_kbd:boolean;  { Set to false if no extended support. }

function readkey:char;
function keypressed:boolean;

{* = extended }

Const F1=#59;    Shift_F1=#84;    Ctrl_F1=#94;    Alt_F1=#104;
      F2=#60;    Shift_F2=#85;    Ctrl_F2=#95;    Alt_F2=#105;
      F3=#61;    Shift_F3=#86;    Ctrl_F3=#96;    Alt_F3=#106;
      F4=#62;    Shift_F4=#87;    Ctrl_F4=#97;    Alt_F4=#107;
      F5=#63;    Shift_F5=#88;    Ctrl_F5=#98;    Alt_F5=#108;
      F6=#64;    Shift_F6=#89;    Ctrl_F6=#99;    Alt_F6=#109;
      F7=#65;    Shift_F7=#90;    Ctrl_F7=#100;   Alt_F7=#110;
      F8=#66;    Shift_F8=#91;    Ctrl_F8=#101;   Alt_F8=#111;
      F9=#67;    Shift_F9=#92;    Ctrl_F9=#102;   Alt_F9=#112;
      F10=#68;   Shift_F10=#93;   Ctrl_F10=#103;  Alt_F10=#113;
      F11=#133;  Shift_F11=#135;  Ctrl_F11=#137;  Alt_F11=#139;  {****}
      F12=#134;  Shift_F12=#136;  Ctrl_F12=#138;  Alt_F12=#140;  {****}

      Alt_1=#120;     Alt_2=#121;     Alt_3=#122;   Alt_4=#123;
      Alt_5=#124;     Alt_6=#125;     Alt_7=#126;   Alt_8=#127;
      Alt_9=#128;     Alt_0=#129;

      Alt_A=#30;      Alt_B=#48;      Alt_C=#46;     Alt_D=#32;
      Alt_E=#18;      Alt_F=#33;      Alt_G=#34;     Alt_H=#35;
      Alt_I=#23;      Alt_J=#36;      Alt_K=#37;     Alt_L=#38;
      Alt_M=#50;      Alt_N=#49;      Alt_O=#24;     Alt_P=#25;
      Alt_Q=#16;      Alt_R=#19;      Alt_S=#31;     Alt_T=#20;
      Alt_U=#22;      Alt_V=#47;      Alt_W=#17;     Alt_X=#45;
      Alt_Y=#21;      Alt_Z=#44;

      Shift_Tab=#15;
      Ctrl_tab=#148;  {*}
      Alt_tab=#165;   {*}

      Alt_Esc=#1;     {*}
      alt_BS=#14;     {*}

      Home=#71;
      Up=#72;
      PgUp=#73;
      Left=#75;
      Right=#77;
      End_=#79;    { Note the underscore as End is a reserved word }
      Down=#80;
      PgDn=#81;
      Ins=#82;
      Del=#83;

      Ctrl_PrtSc=#114;

      Ctrl_Left=#115;
      Ctrl_Right=#116;
      Ctrl_End=#117;
      Ctrl_PgDn=#118;
      Ctrl_Home=#119;
      Ctrl_PgUp=#132;

implementation

{$undef asm}

{$ifdef ver70} {$define asm} {$endif}
{$ifdef ver60} {$define asm} {$endif}

{$ifndef asm}
uses dos;
{$endif}

const scancode:char=#0;

{ This routine replaces crt.keypressed. It uses int 16h, ah=11h.
  if there is a scancode in buffer then it immediately returns true }

{$ifndef asm}
function keypressed:boolean;
var rg:registers;
begin
  if scancode>#0 then keypressed:=true
    else begin
           rg.ah:=ord(extended_kbd)*$10+1;
           intr($16,rg);
           keypressed:=rg.flags and fzero=0;
         End;
End;
{$else}

function keypressed:boolean; assembler;
         asm
         cmp scancode,0

         mov al,1
         ret

         mov cl,4
         shl ah,cl
         inc ah
         int 16h
         mov al,1


{$endif}

{ This routine replaces the crt.readkey. It uses int 16h. ah=10h.
  If there is a scancode in buffer it is immediately returned.

  They grey cursor keys report E0h as ASCII code instead of
  zero, so this has to be changed to zero. However, one must be
  careful as ASCII E0h (224d) can also be alpha as entered from
  keypad }

{$ifndef asm}
function readkey:char;
var rg:registers;
begin
  if scancode>#0 then begin
      readkey:=scancode;
      scancode:=#0;
      exit;
  End;
  rg.ah:=ord(extended_kbd)*$10;
  intr($16,rg);
  if (rg.al=$E0) and (rg.ah>70) then rg.al:=0;  { Grey cursor keys }
  readkey:=chr(rg.al);
  if rg.al=0 then scancode:=chr(rg.ah);
End;

{$else}

function readkey:char; assembler;
         asm
         mov al,scancode
         or al,al

         mov scancode,0
         ret

         mov cl,4
         shl ah,cl
         int 16h
         cmp al,0E0h

         cmp al,70

         xor al,al



{$endif}

var tmp:byte;
    tmp2:word;

function status:word;
         inline(
         $B8/$00/$12/      {MOV AX,1200h}
         $CD/$16           {INT 16h }
         );

{$ifdef msdos}
const seg0040=$40;
{$endif}

begin
  tmp:=mem[Seg0040:$17];
  extended_kbd:=false;
  if lo(status)=tmp then begin
     mem[Seg0040:$17]:=tmp xor 7;
     tmp2:=status;
     extended_kbd:=(tmp2<>$1200) and (lo(tmp2)=tmp xor 7);
     mem[Seg0040:$17]:=tmp;
  End;
end.



Wed, 18 Jun 1902 08:00:00 GMT  
 Reading F11-F12, Numeric-5 keys in TP7


:Simple question: How to read F11-F12 keys

 78) How do I detect if the F11 or F12 key has been pressed?

 164990 Apr 25 1999 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

:and "5" key on numeric pad in TP7?

Maybe:
 131) Where do I get ASCII and scan codes for the different keys?

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa

Timo's  procmail tips at  http://www.uwasa.fi/~ts/info/proctips.html



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

 Relevant Pages 

1. Reading F11 and F12 keys

2. A unit for using F11, F12, and other enhanced keyboard keys with TP/BP

3. F10,F11 and F12

4. cannot read numeric value from a table

5. Function keys (TP7.0)

6. How To Read In Special Key?

7. read cursor keys

8. Reading function/cursor keys

9. read cursor key

10. Reading the Function keys

11. Read more then one key

12. how to read a function key press?

 

 
Powered by phpBB® Forum Software