The keys "-"/"+"/"*" 
Author Message
 The keys "-"/"+"/"*"

Hi everyone,

I need to tell the +/-/*-keys on the number block (NumLock) from the
ones which belong to the main block (letters, numbers).
I can't do that with the normal keycodes, because there is only one
keycode for eg. the + on the number block and the + on the main block.
But I still want to go on using ReadKey/KeyPressed.
Any ideas?

Please contact me if you have.
Thank you in advance,

Olaf




Wed, 18 Jun 1902 08:00:00 GMT  
 The keys "-"/"+"/"*"

Quote:

>Hi everyone,

>I need to tell the +/-/*-keys on the number block (NumLock) from the
>ones which belong to the main block (letters, numbers).
>I can't do that with the normal keycodes, because there is only one
>keycode for eg. the + on the number block and the + on the main block.
>But I still want to go on using ReadKey/KeyPressed.
>Any ideas?

Since the readkey/keypressed reports them as same you cannot continue
using them. You need to use int 16h directly.

Interrupt List, part 3 of 10
This compilation is Copyright (c) 1989,1990,1991,1992,1993 Ralf Brown
--------B-1600-------------------------------
INT 16 - KEYBOARD - GET KEYSTROKE
        AH = 00h
Return: AH = BIOS scan code
        AL = ASCII character
Notes:  on extended keyboards, this function discards any extended keystrokes,
          returning only when a non-extended keystroke is available
        the BIOS scan code is usually, but not always, the same as the hardware
          scan code processed by INT 09.  It is the same for ASCII keystrokes
          and most unshifted special keys (F-keys, arrow keys, etc.), but
          differs for shifted special keys.
SeeAlso: AH=01h,AH=05h,AH=10h,AH=20h,INT 18/AH=00h
--------B-1601-------------------------------
INT 16 - KEYBOARD - CHECK FOR KEYSTROKE
        AH = 01h
Return: ZF set if no keystroke available
        ZF clear if keystroke available
            AH = BIOS scan code
            AL = ASCII character
Note:   if a keystroke is present, it is not removed from the keyboard buffer;
          however, any extended keystrokes which are not compatible with 83/84-
          key keyboards are removed in the process of checking whether a
          non-extended keystroke is available
SeeAlso: AH=00h,AH=11h,AH=21h,INT 18/AH=01h

And then for computers with enhanced keyboard support:

--------B-1610-------------------------------
INT 16 - KEYBOARD - GET ENHANCED KEYSTROKE (enhanced kbd support only)
        AH = 10h
Return: AH = BIOS scan code
        AL = ASCII character
Notes:  if no keystroke is available, this function waits until one is placed
          in the keyboard buffer
        the BIOS scan code is usually, but not always, the same as the hardware
          scan code processed by INT 09.  It is the same for ASCII keystrokes
          and most unshifted special keys (F-keys, arrow keys, etc.), but
          differs for shifted special keys.
        unlike AH=00h, this function does not discard extended keystrokes
        INT 16/AH=09h can be used to determine whether this function is
          supported, but only on later model PS/2s
SeeAlso: AH=00h,AH=09h,AH=11h,AH=20h
--------B-1611-------------------------------
INT 16 - KEYBOARD - CHECK FOR ENHANCED KEYSTROKE (enh kbd support only)
        AH = 11h
Return: ZF set if no keystroke available
        ZF clear if keystroke available
            AH = BIOS scan code
            AL = ASCII character
Notes:  if a keystroke is available, it is not removed from the keyboard buffer
        unlike AH=01h, this function does not discard extended keystrokes
        some versions of the IBM BIOS Technical Reference erroneously report
          that CF is returned instead of ZF
        INT 16/AH=09h can be used to determine whether this function is
          supported, but only on later model PS/2s
SeeAlso: AH=01h,AH=09h,AH=10h,AH=21h

Experiment with these to find out the scan codes. The difference is in the
scan code reported. The keys + - and / work on the standard function
keys, if you want also the division, then you need the extended
functions.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 The keys "-"/"+"/"*"

Quote:

>Hi everyone,

>I need to tell the +/-/*-keys on the number block (NumLock) from the
>ones which belong to the main block (letters, numbers).
>I can't do that with the normal keycodes, because there is only one
>keycode for eg. the + on the number block and the + on the main block.
>But I still want to go on using ReadKey/KeyPressed.
>Any ideas?

The KEYBOARD Unit http://users.leading.net/~rdonais/tPascal.htm
ReadKey function returns a word w/ the scan code in the high byte
and the ascii character in the low byte.  The unit also contains
definitions which includes PADplus and PADminus.  Rather than
KeyPressed, the unit contains an Inkey function that returns TRUE
if a key is pending and FALSE otherwise.  The pending key is
available in a global word TC and shift status at the time
keyboard was tested is available in TS.  ReadKey also updates TC
and TS for the returned key.

I used to place this unit after CRT in the uses clause which would
make the KEYBOARD.KeyPressed the default function.  If you really
want to continue using CRT readkey and keypressed, you could still
use the INKEY function and examine TC to determine the source of
the plus or minus sign.

FWIW, there are three ways to generate either key.  Any key with a
scan code of zero indicates that the key was generated using an
ALT+numeric_keypad sequence.  For example,  

   TC = $4E2B = KeyPad +
   TC = $0D2B = Normal +
   TC = $002B = ALT+043

Unit is compatible with TP 4.0 through 7.0.  Archive contains all
source so you can us it as-is, or cut the parts you want and put
them in your own unit.

    ...red



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

 Relevant Pages 

1. ""256 Color Mouse""

2. EDBEngineError..."Record/Key deleted"

3. TTable - "Record/Key deleted"

4. "Record/Key deleted"

5. HELP -- "Key group is locked" error

6. "Record/Key Deleted" BDE Error

7. Interception of message "key invalidation"

8. Need help on "Record/Key deleted"

9. Interbase error "record/Key deleted"

10. "Record/Key Deleted" BDE Error

11. "Record/Key Deleted" Error

12. What are "Denormals" and "Nans"

 

 
Powered by phpBB® Forum Software