Difference between revisions of "Mouse.button"
Jump to navigation
Jump to search
(Add link to howto) |
|||
Line 27: | Line 27: | ||
end while | end while | ||
key.clear // (clear escape key from key buffer)</ms> | key.clear // (clear escape key from key buffer)</ms> | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [[How to detect single mouse clicks]] | ||
[[Category:Mini Micro]] | [[Category:Mini Micro]] |
Latest revision as of 15:16, 20 November 2021
In Mini Micro, the mouse.button function returns whether a given mouse button is currently pressed.
Contents
Arguments
Parameter Name | Default Value | Meaning |
---|---|---|
which | 0 | which button (0 through 6) to check |
Usage Notes
The main mouse button is button 0, and this is also the default. So in typical cases, no argument to mouse.button is needed.
This method returns 1 (true) while the button is pressed, and 0 (false) when it is not.
Example
This example continuously displays the value of all mouse buttons. Run this, then click various buttons on your mouse to test. (Note that most mice have only three buttons, so the rest will always return 0.)
while not key.pressed("escape")
text.row = 10
print "mouse.button: " + mouse.button
for b in range(1,6)
print "mouse.button(" + b + "): " + mouse.button(b)
end for
end while
key.clear // (clear escape key from key buffer)