Mouse Down

The MouseDown event occurs when you click on a blank area of the form, the form's record selector, or a control placed on the form. This event occurs before the Click event. The MouseDown event has four arguments:

Button — Identifies the state of the mouse buttons. Use acLeftButton to check for the left mouse button, acRightButton to check for the right mouse button, and acMiddleButton to check for the middle mouse button. Shift — Specifies the state of the Shift, Ctrl, and Alt keys when the button specified by the Button argument was pressed or released. Use acShiftMask(l) to test for the Shift key, acCtrlMask(2) to test for the Ctrl key, and acAltMask(4) to test for the Alt key. You can test for any combination of buttons. For example, to specify that Ctrl and Alt were pressed, use the value of 6 (2+4) as the Shift argument.

X — Specifies the horizontal (x) position from the left edge of the form or control.

Y — Specifies the vertical (y) position from the top edge of the form or control.

Part IV

The event procedure in Hands-On 24-13 displays two messages when the form's MouseDown event is fired. The first message tells whether you pressed the Alt, Ctrl, or Shift key, and the second one announces which mouse button was used.

0 0

Post a comment