xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET EVENTMASK

Sets which events should be returned by the Inkey() function.

Syntax

SET EVENTMASK TO <nEventMask>

Arguments

TO <nEventMask>
<nEventMask> is a numeric value specifying the type of events to return by the Inkey() function. The argument can be a combination , or sum, of #define constants taken from the file Inkey.ch. It can also be specified as a numeric expression enclodes in parentheses.

Constants for <nEventMask>
ConstantValueEvents returned by Inkey()
INKEY_MOVE1Mouse pointer moved
INKEY_LDOWN2Left mouse button pressed
INKEY_LUP4Left mouse button released
INKEY_RDOWN8Right mouse button pressed
INKEY_RUP16Right mouse button released
INKEY_MMIDDLE32Middle mouse button pressed
INKEY_MWHEEL64Mouse wheel turned
INKEY_KEYBOARD128Key pressed
INKEY_ALL255All events are returned

The default value for <nEventMask> is INKEY_KEYBOARD, i.e. the Inkey() function returns only keyboard events and ignores the mouse.

Description

The SET EVENTMASK command determines which type of events should be returned by the Inkey() function. By default, only keyboard events are returned by Inkey(). This is a compatibility setting and should be changed to INKEY_ALL at program start. The reaction to events coming from the mouse can then be programmed in a DO CASE or SWITCH structure.

Info

See also:HB_KeyPut(), Inkey(), Lastkey(), Nextkey(), MCol(), MRow(), SET KEY, Set()
Category: Input commands , SET commands
Header:Inkey.ch
Source:rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example changes the event mask for Inkey() to ALL events
// and displays the mouse cursor position.

   #include "Inkey.ch"

   PROCEDURE Main
      LOCAL nEvent

      SET EVENTMASK TO INKEY_ALL

      DO WHILE Lastkey() <> K_ESC
         ? nEvent := Inkey(0)

         IF nEvent > 999
            // display current mouse cursor position
            ?? MRow(), MCol()
         ENDIF
      ENDDO

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe