[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Set the mouse capture to the specified control, or one of its children, at the given coordinates.
Source position: controls.pp line 2759
procedure SetCaptureControl( |
AWinControl: TWinControl; |
const Position: TPoint |
); |
Control: TControl |
); |
AWinControl |
|
TWinControl instance (or Nil) representing the windowed control for the mouse capture. |
Position |
|
TPoint instance with the coordinates for the mouse input. |
Control |
|
TControl instance (or Nil) representing the control for the mouse capture. |
SetCaptureControl is an overloaded procedure in controls.pp. It ensures that the CaptureControl variable maintained in the LCL is updated when an control receives or loses the mouse input focus.
The overloaded variants allow the new mouse capture control to be specified as either a TControl or a TWinControl instance. No actions are performed in the routine if the specified control is already the CaptureControl.
If the new capture control is unassigned (Nil), the value in CaptureControl is cleared and the ReleaseCapture routine is called. No additional actions are performed in the routine.
Otherwise, the control class is used to determine the actions needed. For a TWinControl instance, the ControlAtPos method is called determine if a child control is active at the specified position and the new capture control. For a TControl instance, which does not have a handle, the Parent control is used as the new capture control.
ReleaseCapture is called to remove mouse capture for the previous control. The SetCapture routine in the LCL interface is called to change the mouse capture to the control with the specified handle.
Use GetCaptureControl to retrieve the control which currently has the mouse capture.
|
Returns the TControl instance with mouse capture enabled. |
Version 3.2 | Generated 2024-02-25 | Home |