xHarbour Reference Documentation > Command Reference |
Sets which events should be returned by the Inkey() function.
SET EVENTMASK TO <nEventMask>
Constants for <nEventMask>
Constant | Value | Events returned by Inkey() |
---|---|---|
INKEY_MOVE | 1 | Mouse pointer moved |
INKEY_LDOWN | 2 | Left mouse button pressed |
INKEY_LUP | 4 | Left mouse button released |
INKEY_RDOWN | 8 | Right mouse button pressed |
INKEY_RUP | 16 | Right mouse button released |
INKEY_MMIDDLE | 32 | Middle mouse button pressed |
INKEY_MWHEEL | 64 | Mouse wheel turned |
INKEY_KEYBOARD | 128 | Key pressed |
INKEY_ALL | 255 | All events are returned |
The default value for <nEventMask> is INKEY_KEYBOARD, i.e. the Inkey() function returns only keyboard events and ignores the mouse.
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.
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 |
// 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
http://www.xHarbour.com