MouseDown, MouseUp Events

Applies To

Bound Object Frame Control, Chart Control, Check Box Control, Combo Box Control, Command Button Control, Form, Form Section, Image Control, Label Control, List Box Control, Option Button Control, Option Group Control, Rectangle Control, Text Box Control, Toggle Button Control, Unbound Object Frame Control.

Description

These events occur:

  • MouseDown — When the user presses a mouse button.
  • MouseUp — When the user releases a mouse button.

Note Notes

  • The MouseDown and MouseUp events apply only to forms, form section, and controls on a form.
  • These events don’t apply to a label attached to another control, such as the label for a text box. They apply only to “freestanding” labels. Pressing and releasing a mouse button in an attached label has the same effect as pressing and releasing the button in the associated control. The normal events for the control occur; no separate events occur for the attached label.

Remarks

You can use a MouseDown or MouseUp event to specify what happens when a particular mouse button is pressed or released. Unlike the Click and DblClick events, the MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keys.

To cause a MouseDown or MouseUp event for a form to occur, press the mouse button in a blank area, record selector, or scroll bar on the form. To cause a MouseDown or MouseUp event for a form section to occur, press the mouse button in a blank area of the form section after selecting the section. To select the form section, click the section header.

The following apply to both MouseDown and MouseUp events:

  • If a mouse button is pressed while the pointer is over a form or control, that object receives all mouse events up to and including the last MouseUp event.
  • If mouse buttons are pressed in succession, the object that receives the mouse event after the first press receives all mouse events until all buttons are released.

To respond to an event caused by moving the mouse, you use a MouseMove event.

See Also

Click Event; DblClick Event; Enter, Exit Events; GotFocus, LostFocus Events; MouseMove Event.