RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMouse.Capture Property

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

Pascal
property Capture: HWND;
C++
__property HWND Capture;

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. 

 

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