Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- dBsee 4.6 - The Library - <b>dfkeypres()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
dfKeyPres()
Verifies if an extended key was pressed
------------------------------------------------------------------------------
Syntax:

     dfKeyPres( <nKey> ) --> lPressed

Parameters:

     <nKey>     Key to verify. Values are definied in DFKEY.CH. dfKeyPres()
     verifies :
     +-----------------------------------------------+
     | #define        |  # | Description             |
     |----------------+----+-------------------------|
     | KEY_EITHERALT  |  1 | ALT                     |
     | KEY_EITHERCTRL |  2 | CTRL                    |
     | KEY_LEFTSHIFT  |  3 | Left SHIFT              |
     | KEY_RIGHTSHIFT |  4 | Right SHIFT             |
     | KEY_INSERT     |  5 | INSERT                  |
     | KEY_CAPSLOCK   |  6 | CAPS LOCK               |
     | KEY_NUMLOCK    |  7 | NUM LOCK                |
     | KEY_SCROLLLOCK |  8 | SCROLL LOCK             |
     | KEY_LEFTALT    |  9 | Left ALT                |
     | KEY_LEFTCTRL   | 10 | Left CTRL               |
     | KEY_RIGHTALT   | 11 | Right ALT               |
     | KEY_RIGHTCTRL  | 12 | Right CTRL              |
     +-----------------------------------------------+

Returns:

     <lPressed> Is .T. if the given key has been pressed. If the key does
     not exist on the keyboard, .F. will be returned

Description:

     Verifies if a given key has been pressed.

Example:

     #include "DFKEY.CH"
     * ###########################################
     PROCEDURE tKey()
     * ###########################################
     LOCAL nKey
     
     CLS
     
     @  1, 5 SAY " KEY_EITHERALT  "
     @  2, 5 SAY " KEY_EITHERCTRL "
     @  3, 5 SAY " KEY_LEFTSHIFT  "
     @  4, 5 SAY " KEY_RIGHTSHIFT "
     @  5, 5 SAY " KEY_INSERT     "
     @  6, 5 SAY " KEY_CAPSLOCK   "
     @  7, 5 SAY " KEY_NUMLOCK    "
     @  8, 5 SAY " KEY_SCROLLLOCK "
     @  9, 5 SAY " KEY_LEFTALT    "
     @ 10, 5 SAY " KEY_LEFTCTRL   "
     @ 11, 5 SAY " KEY_RIGHTALT   "
     @ 12, 5 SAY " KEY_RIGHTCTRL  "
     
     WHILE LASTKEY() # K_ESC
        @  0, 0 SAY IF( (nKey:=INKEY())#0, nKey, "" )
        @  1, 0 SAY dfKeyPres( KEY_EITHERALT  )
        @  2, 0 SAY dfKeyPres( KEY_EITHERCTRL )
        @  3, 0 SAY dfKeyPres( KEY_LEFTSHIFT  )
        @  4, 0 SAY dfKeyPres( KEY_RIGHTSHIFT )
        @  5, 0 SAY dfKeyPres( KEY_INSERT     )
        @  6, 0 SAY dfKeyPres( KEY_CAPSLOCK   )
        @  7, 0 SAY dfKeyPres( KEY_NUMLOCK    )
        @  8, 0 SAY dfKeyPres( KEY_SCROLLLOCK )
        @  9, 0 SAY dfKeyPres( KEY_LEFTALT    )
        @ 10, 0 SAY dfKeyPres( KEY_LEFTCTRL   )
        @ 11, 0 SAY dfKeyPres( KEY_RIGHTALT   )
        @ 12, 0 SAY dfKeyPres( KEY_RIGHTCTRL  )
     ENDDO
     
     RETURN

See also:

     dfInkey()

See Also: dfInkey()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson