Vcl.Controls.TMouse.Capture

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Capture: HWND read GetCapture write SetCapture;

C++

__property HWND Capture = {read=GetCapture, write=SetCapture, nodefault};

Properties

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

Description

Specifies the handle of the window that is capturing mouse events.

Read Capture to get the handle of the window that receives all mouse messages. This is the window that is currently responding to the user's mouse actions.

Set Capture to the Handle property of a control to let it "capture" the mouse. When a window captures the mouse, it receives all mouse messages until it releases the mouse.

Typically, applications do not need to explicitly set the Capture property. Individual controls automatically capture the mouse in response to mouse clicks. They then translate incoming mouse message into events such as OnMouseDown or OnMouseMove. You only need to set Capture to override this default behavior. For example, when writing an object that creates a child control in response to a mouse click, you might set Capture to the child control's Handle property so that it receives subsequent mouse messages until the mouse button is released.

See Also