Skip to main content

Mouse Class

Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost

Allows a usb device to be used a mouse.

class Mouse(BaseDevice): ...

Remarks​

By default, the reported range for position is between 0 and 512, as on TinyCLR: set it to the screen with SetCursorBounds. The events come on the mouse's own thread.

Nested Types​

TypeKindSummary
Mouse.ButtonChangedEventArgsClassThe events args for the ButtonPressed and ButtonReleased events.
Mouse.ButtonChangedEventHandlerDelegateThe delegate for when one of the mouse's button is pressed or released.
Mouse.CursorMovedEventArgsClassThe events args for the CursorMoved event.
Mouse.CursorMovedEventHandlerDelegateThe delegate for when the mouse's cursor moves.
Mouse.WheelMovedEventArgsClassThe events args for the WheelMoved event.
Mouse.WheelMovedEventHandlerDelegateThe delegate for when the mouse's wheel moves.

Constructors​

Mouse(string deviceName)​

def __init__(self, deviceName: str):

Opens the mouse that UsbHostController reported ("/dev/input/event2").

Properties​

AbsolutePosition​

AbsolutePosition: bool # @property

Return true for absolute, false for relative mode (a USB mouse moves relative).

Returns bool

CursorPosition​

CursorPosition: Position # @property

The current position of the cursor.

Returns Position

Extended1ButtonState​

Extended1ButtonState: ButtonState # @property

The current state of the mouse's first extended button.

Returns ButtonState

Extended2ButtonState​

Extended2ButtonState: ButtonState # @property

The current state of the mouse's second extended button.

Returns ButtonState

LeftButtonState​

LeftButtonState: ButtonState # @property

The current state of the mouse's left button.

Returns ButtonState

MiddleButtonState​

MiddleButtonState: ButtonState # @property

The current state of the mouse's middle button.

Returns ButtonState

RightButtonState​

RightButtonState: ButtonState # @property

The current state of the mouse's right button.

Returns ButtonState

WheelPosition​

WheelPosition: int # @property

The current position of the mouse wheel.

Returns int

Methods​

SetCursorBounds(Position minimum, Position maximum)​

def SetCursorBounds(self, minimum: Position, maximum: Position) -> None:

Sets the cursor bounds.

ParameterTypeDescription
minimumPositionThe minimum bound.
maximumPositionThe maximum bound.

SetCursorPosition(Position newPosition)​

def SetCursorPosition(self, newPosition: Position) -> None:

Sets the cursor position.

ParameterTypeDescription
newPositionPositionThe new position of the cursor.

SetScale(float scale)​

def SetScale(self, scale: float) -> None:

Scales the x, y, and wheel delta values.

ParameterTypeDescription
scalefloatThe value by which to scale the data.

Events​

ButtonChanged​

ButtonChanged # += / -= handler

The event fired when one of the mouse's buttons is pressed or released.

CursorMoved​

CursorMoved # += / -= handler

The event fired when the mouse's cursor has moved.

WheelMoved​

WheelMoved # += / -= handler

The event fired when the mouse's wheel has moved.