Vcl.Controls.TMouse.CursorPos

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property CursorPos: TPoint read GetCursorPos write SetCursorPos;

C++

__property System::Types::TPoint CursorPos = {read=GetCursorPos, write=SetCursorPos};

Properties

Type Visibility Source Unit Parent
property public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TMouse

Description

Specifies the position of the mouse cursor.

Use CursorPos to get the position of the mouse cursor in global coordinates. Use this position to position UI elements in relation to the mouse. For example, the position of popup menus or the display of the drag rectangle during drag-and-dock operations is based on the value of CursorPos.

CursorPos can raise an exception. The property getter API call is wrapped with Win32Check, which raises the exception, EOSException, if the function fails. The API call is shown in the following code:

function TMouse.GetCursorPos: TPoint; begin Win32Check(Windows.GetCursorPos(Result)); end;

Code Examples