[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
XPmouseKey()
equivalent to Inkey, handle Mouse
------------------------------------------------------------------------------
Function: XPmouseKey()
XPmouseKey() has the same functionality as the inkey(0)
function, with that difference that it will return 13
(Enter, K_ENTER) when the left button is pressed and 27
(Esc, K_ESC) for the right button (And now, also 32 (Space,
K_SPACE) for the Middle button. You could thus use
XPmouseKey() everywhere in your application where Inkey(0)
(ie. wait for a key) was previously used, especially
handy for the 'Press any key' and alike messages, where
users generally assume that clicking the mouse is also
good enough.
This function does not require a Mouse to be installed,
but just uses it when XPmouseThere() returns true. This
function will not make the Mouse cursor visible, as
there's nothing to move to.
The value of Lastkey() will be set, even if a Mouse
button has been pressed.
Syntax: XPmouseKey()
Arguments: None.
Returns: Keyboard code exactly as Inkey(0), and 13 for Left
button and 27 for right button.
Usage: Msg('Press any key to continue')
MouseKey()
Note: This is a simple function, just written to facilitate
using those "press any key messages". It is not intended as
a serious replacement for all you keyboard input.
A look at the source code informs you it is quite simple:
#include "EXPAND.CH"
#include "INKEY.CH"
Function XPmouseKey()
/* Just as Inkey(0), with Mouse */
Local i
if XPmouseThere()
i := inkey()
while i = 0
if XPmouseRight()
While XPmouseRight() ; end
i := (K_ESC)
elseif XPmouseLeft()
While XPmouseLeft() ; end
i := (K_ENTER)
elseif XPmouseMiddle()
While XPmouseMiddle() ; end
i := (K_SPACE)
else
i := inkey()
end
End
else
i := inkey(0)
end
Return (i)
See Also:
XPmouseThere()
XPmouseGet()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson