MouseOverlord Module
All Mouse Overlord methods and properties are invoked and read via this module.
Note: All properties and methods listed below have public scope and must be prefixed with the MouseOverlord namespace and dot notation.
Properties
Expand All | Collapse All
-
Captured As Boolean
Returns True if the mouse is currently captured. -
CursorIsVisible As Boolean
Returns True if the mouse cursor is currently visible. Use the MouseOverlord.HideCursor and MouseOverlord.ShowCursor methods to control the cursor's visible state.
Important: This requires Mac OS X 10.3 or higher, and will always return False on lesser versions.
Methods
Expand All | Collapse All
-
Capture ( eventHandler As MouseOverlordEventHandler, disableAcceleration As Boolean = False ) As Boolean
Captures the mouse and forwards events to the provided MouseOverlordEventHandler instance. Returns True if the mouse was successfully captured. While captured, the cursor is locked and your application has exclusive access to all mouse events. The optional disableAcceleration parameter can be set to True to turn off the system acceleration curve as defined in the System Preferences. Note that capturing the mouse will not automatically hide the cursor - use the MouseOverlord.HideCursor and MouseOverlord.ShowCursor methods to control cursor visibility.
Important: Be sure to call MouseOverlord.Release prior to quitting to properly restore the mouse settings. This is doubly important if the The optional disableAcceleration parameter is set to True, since mouse acceleration is a system-wide setting and will remain modified until MouseOverlord.Release is called.
Note: This method creates an invisible overlay window to trap mouse events. REALbasic 2007r1 or higher is recommended to avoid an overlay window bug present in previous versions. -
ForceUpdate
Forces an event update and immediately sends new mouse events to the MouseOverlordEventHandler instance passed to the MouseOverlord.Capture method. This can be useful to gather events from inside tight loops or when REALbasic's main thread is otherwise blocked. This method only has an effect while the mouse is captured. -
HideCursor
Hides the mouse cursor, and increments the system's hide cursor count. -
MoveCursor ( X As Single, Y As Single )
Moves the cursor to the specified X and Y coordinates relative to the top-left corner of the main screen (0,0). Note that the cursor can not be moved while it is captured. -
Release
Releases the captured mouse and stops gathering mouse events. This must be called after MouseOverlord.Capture to properly restore the mouse system settings. -
ShowCursor
Decrements the system's hide cursor count, and shows the cursor if the count is zero. E.g. if MouseOverlord.HideCursor was called twice in a row, this method must be called twice to actually show the cursor. Note that the system may modify the hide cursor count beyond your control when manipulating certain user interface elements.