RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMouse.CursorPos Property

Specifies the position of the mouse cursor.

Pascal
property CursorPos: TPoint;
C++
__property TPoint CursorPos;

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. 

TMouse. 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;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!