[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   WM_KEY...
   Keyboard messages
------------------------------------------------------------------------------

  The WM_KEYx messages are sent when the user presses or releases a
  non-system ( WM_KEY.. ) or non-control ( WM_CHAR ) key.

  A nonsystem key is a key that is pressed when the ALT key is not pressed, 
  or a key that is pressed when a window has the input focus. A non-control 
  key is the result of a WM_KEYDOWN and a WM_KEYUP message, and the 
  pressed key was a normal char.

  two of this messages are passed up to clipper level and can be used to 
  trigger keyboard events. Here are the messages and their FiveWin 
  counterparts :

  +------------------------------------------------------------------------+
  | Message            ActionBlock    SendMethod    Send when              |
  |------------------------------------------------------------------------|
  | WM_KEYDOWN       | bKeyDown     | KeyDown     | nonsystem key pressed  |
  | WM_KEYUP         | --           | --          | --                     |
  | WM_CHAR          | bKeyChar     | KeyChar     | nonControl key pressed |
  +------------------------------------------------------------------------+

  Each of this messages is attended by two arguments. They are converted
  to clipper parameters by FiveWin and then passed to the Actionblocks when
  they are evaluated ( like EVAL( bClicked, nKey, nKeyData )), where:


  <nKey>       Is the virtual key code of the given key. Some of the
               Key codes corrosponds to Clipper INKEY-Codes, please press
                Related Topics:  and select  VK Table 


  <nKeyData>   Specifies several internal values in binary form. The
               numbers refer to the BitPosition. To test single Bits, use
               the lAnd() Function like described in the WM_BUTTON
               section

                0-15  Specifies the repeat count. The value is the number 
                      of times the keystroke is repeated as a result of the 
                      user holding down the key. 

               16-23  Specifies the scan code. The value depends on the OEM

                  24  Specifies whether the key is an extended key, such as
                      a function key or a key on the numeric keypad. The 
                      value is TRUE if it is an extended key.
  
               25-28  Internally used by Windows

                  29  Specifies the context code. The value is TRUE if the
                      ALT key is held down while the key is pressed

                  30  Specifies the previous key state. The value is TRUE 
                      if the key is down before the message is sent, or 
                      FALSE if the key is up. 

                  31  Specifies the key-transition state. The value is TRUE 
                      if the key is being released, or FALSE if the key is 
                      being pressed. 


  HINTS:

  The bKeyChar and bKeyDown Actionblocks are very usefull to intercept
  special KeyCodes :

     +-------------------------------------------------------------+
     |  /* respond to K_ENTER */                                   |
     |  oWin:bKeyDown := {|nKey| IIF( nKey == VK_RETURN,;          |
     |                           MsgInfo( "Enter pressed !"),0)    |
     +-------------------------------------------------------------+


   Or a combination of key and control key, checked with GetKeyState()

     +-------------------------------------------------------------+
     |  /* respond to CTR-F6 */                                    |
     |  oWin:bKeyDown := {|nKey| IIF( nKey == VK_F6 .AND. ;        |
     |                       GetKeyState( "VK_CONTROL" ),;         |
     |                           MsgInfo( "Enter pressed !"),0)    |
     +-------------------------------------------------------------+




See Also: WM_BUTTON VK table bKeyDown bKeyChar lAnd GetKeyState
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson