Mouse

This demo covers the Tripous mouse helpers. tp.Mouse maps browser mouse buttons to Tripous constants, reads pressed button bit-fields, converts event coordinates, and can find the element under the pointer.

tp.MouseInfo captures a mouse or pointer event into a reusable object. It stores modifier keys, the event button, the current pressed buttons, and document, viewport, and screen coordinates.

Live mouse event

Move or click inside the box. Left, middle, and right clicks are identified through tp.Mouse.Button(), tp.Mouse.IsLeft(), tp.Mouse.IsMid(), and tp.Mouse.IsRight().

Move or click here

Button constants and cursors

tp.Mouse.LEFT, tp.Mouse.RIGHT, and tp.Mouse.MID are numeric constants. tp.Cursors contains CSS cursor names.

Simulated buttons

These buttons create standard MouseEvent objects and dispatch them to the target box, so the helper checks are easy to repeat.

Coordinates and MouseInfo

tp.Mouse.ToElement() returns element-relative coordinates. tp.MouseInfo captures the same event into a structured object.