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

# SetMouseXY

Set the mouse cursor position.

## Declaration

Source position: mouseh.inc line 89

`procedure SetMouseXY(`
`x: Word;`
`y: Word`
`);`

## Description

SetMouseXY places the mouse cursor on X,Y. X and Y are zero based character coordinates: 0,0 is the top-left corner of the screen, and the position is in character cells (i.e. not in pixels).

## Errors

None.

## See also

GetMouseX |  | Query the current horizontal position of the mouse cursor.
GetMouseY |  | Query the current vertical position of the mouse cursor.

## Example

    Program Example7;

    { Program to demonstrate the SetMouseXY function. }

    Uses mouse;

    begin
      InitMouse;
      Writeln('Click right mouse button to quit.');
      SetMouseXY(40,12);
      Repeat
        Writeln(GetMouseX,',',GetMouseY);
        If (GetMouseX>70) then
          SetMouseXY(10,GetMouseY);
        If (GetMouseY>20) then
          SetMouseXY(GetMouseX,5);
      Until (GetMouseButtons=MouseRightButton);
      DoneMouse;
    end.