PG_EventMouse Structure

Description

This structure holds data passed to event handlers for all mouse-related events (clicks, movement, wheel, enter/leave). It provides information about the mouse cursor's position relative to the object that received the event, the object's dimensions, and mouse wheel information if applicable.

Structure Definition

Structure PG_EventMouse
  x.d ; Horizontal position of the mouse cursor relative to the object's top-left corner (in DIPs)
  y.d ; Vertical position of the mouse cursor relative to the object's top-left corner (in DIPs)
  xPixels.i ; Horizontal position of the mouse cursor relative to the object's top-left corner (in physical pixels)
  yPixels.i ; Vertical position of the mouse cursor relative to the object's top-left corner (in physical pixels)

  width.d ; Current width of the object (Window or Widget) in DIPs
  height.d ; Current height of the object (Window or Widget) in DIPs
  widthPixels.i ; Current width of the object in physical pixels
  heightPixels.i ; Current height of the object in physical pixels

  wheelDelta.i ; Direction and magnitude of mouse wheel rotation (for #PG_Event_MouseWheel only)
EndStructure

Members

x.d
The horizontal coordinate of the mouse cursor within the object's client area, measured in Device Independent Pixels (DIPs) from the object's left edge.

y.d
The vertical coordinate of the mouse cursor within the object's client area, measured in Device Independent Pixels (DIPs) from the object's top edge.

xPixels.i
The horizontal coordinate of the mouse cursor within the object's client area, measured in physical pixels from the object's left edge.

yPixels.i
The vertical coordinate of the mouse cursor within the object's client area, measured in physical pixels from the object's top edge.

width.d
The current width of the object receiving the event, in DIPs.

height.d
The current height of the object receiving the event, in DIPs.

widthPixels.i
The current width of the object receiving the event, in physical pixels.

heightPixels.i
The current height of the object receiving the event, in physical pixels.

wheelDelta.i
For the #PG_Event_MouseWheel event only. Indicates the direction and amount of wheel rotation. A positive value typically means the wheel was rolled forward (away from the user), and a negative value means backward (toward the user). The magnitude is usually a multiple of 1 (representing standard increments, like `WHEEL_DELTA` on Windows, but normalized). For other mouse events, this value is undefined (likely 0).

Used By Events

Remarks

The `x` and `y` (DIP) coordinates are generally preferred for hit-testing within ProGUI, as they are consistent across different DPI settings. The `xPixels` and `yPixels` are provided for cases needing precise pixel coordinates. For `MouseEnter` and `MouseLeave` events, the exact coordinates might not always be the point of entry/exit but rather the position when the event was processed.

See Also

AddEventHandler, Event Handling Overview

Supported OS

Windows, Linux