[Overview][Constants][Types][Procedures and functions][Variables][Index] | Reference for unit 'Mouse' (#rtl)

# GetMouseButtons

Get the state of the mouse buttons

## Declaration

Source position: mouseh.inc line 86

`function GetMouseButtons: Word;`

## Description

GetMouseButtons returns the current button state of the mouse, i.e. it returns a or-ed combination of the following constants:

MouseLeftButton
  When the left mouse button is held down.
MouseRightButton
  When the right mouse button is held down.
MouseMiddleButton
  When the middle mouse button is held down.

## Errors

None.

## See also

GetMouseEvent |  | Get next mouse event from the queue.
GetMouseX |  | Query the current horizontal position of the mouse cursor.
GetMouseY |  | Query the current vertical position of the mouse cursor.

## Example

    Program Example2;

    { Program to demonstrate the GetMouseButtons function. }

    Uses mouse;

    begin
      InitMouse;
      Writeln('Press right mouse button to exit program');
      While (GetMouseButtons<>MouseRightButton) do ;
      DoneMouse;
    end.