A mouse event occurs when a user moves the mouse in the user interface of an application. The VCL has three mouse events.
Mouse events
Event |
Description |
OnMouseDown event |
Occurs when the user presses a mouse button with the mouse pointer over a control. |
OnMouseMove event |
Occurs when the user moves the mouse while the mouse pointer is over a control. |
OnMouseUp event |
Occurs when the user releases a mouse button that was pressed with the mouse pointer over a component. |
When an application detects a mouse action, it calls whatever event handler you've defined for the corresponding event, passing five parameters. Use the information in those parameters to customize your responses to the events. The five parameters are as follows:
Mouse-event parameters
Parameter |
Meaning |
Sender |
The object that detected the mouse action |
Button |
Indicates which mouse button was involved: mbLeft, mbMiddle, or mbRight |
Shift |
Indicates the state of the Alt, Ctrl, and Shift keys at the time of the mouse action |
X, Y |
The coordinates where the event occurred |
Most of the time, you need the coordinates returned in a mouse-event handler, but sometimes you also need to check Button to determine which mouse button caused the event.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|