[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# CheckMouseButtonDownUp

Checks for mouse click events for the specified control.

## Declaration

Source position: controls.pp line 2765

`function CheckMouseButtonDownUp(`
`const AWinHandle: TLCLHandle;`
`const AWinControl: TWinControl;`
`var LastMouse: TLastMouseInfo;`
`const AMousePos: TPoint;`
`const AButton: Byte;`
`const AMouseDown: Boolean`
`):Cardinal;`

## Arguments

`AWinHandle` |  | Handle for the control where the mouse events were detected.
`AWinControl` |  | Control with the specified handle.
`LastMouse` |  | Mouse information for the mouse event examined in the routine.
`AMousePos` |  | Position where the last mouse event occurred.
`AButton` |  | Mouse button for the last mouse event.
`AMouseDown` |  | True if the mouse event is a mouse down event. False for a mouse up event.

## Function result

Value used as the Msg member in a mouse message.

## Description

CheckMouseButtonDownUp is a Cardinal function used to check for mouse down or up events for the control represented by the handle in AWinHandle. The return value contains the Word value used in the Msg member in a TLMMouse mouse message.

The LastMouse parameter is updated with the most recent mouse event information examined and used in the method.

CheckMouseButtonDownUp consolidates mouse down events (single, double, triple, and quadruple) into a single value used in a mouse message, and updates LastMouse when needed.

AWinControl contains the control with the handle where the mouse event(s) occurred.

At run-time, multi-click events are adjusted to the ControlStyle specified in the control (or one of its children) including:

- csDoubleClicks
- csTripleClicks
- csQuadClicks

If the target control does not allow one of the multi-click events, the click count in LastMouse is updated accordingly.

At design-time, only Single and Double click mouse events are handled.

CheckMouseButtonDownUp is used in the callback routine for a widgetset class when a mouse event message is created and passed to the class instance.

## Version info

Modified in LCL version 4.0 to use the TLCLHandle type instead of the deprecated THandle type in the AWinHandle argument.