OnMouseUp Event

Occurs when the mouse button is released over the object.

Syntax

Object.OnMouseUp( enMouseButton, enKeyShift, fX, fY )

The OnMouseUp event syntax has the following parts:

 

Name

Type

Description

Object

An object

A control or the AForm object

enMouseButton

Val enumAMouseButton

An integer that identifies the button that was pressed (OnMouseDown) or released (OnMouseUp) to cause the event.

enKeyShift

Val enumAKeyShift

An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument is pressed or released.

fX, fY

Val APixel

Returns a number that specifies the current location of the mouse pointer. The fX and fY values are always expressed in terms of the coordinate system set by the Height, Width, Left, and Top properties of the object.

Where

enumAMouseButton can be one of the following:

 

Name

Value

Description

aMouseButtonLeft

1

Left button is pressed.

aMouseButtonRight

2

Right button is pressed.

aMouseButtonMIddle

4

Middle button is pressed.

enumAKeyShift can be one of the following:

 

Name

Value

Description

aKeyShiftNone

0

No key is pressed.

aKeyShiftShift

1

SHIFT key is pressed.

aKeyShiftCtrl

2

CTRL key is pressed.

aKeyShiftAlt

4

ALT key is pressed.

Comments

Use a OnMouseDown or OnMouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released. Unlike the OnClick and OnDblClick events, OnMouseDown and OnMouseUp 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 keyboard modifiers.

The following applies to both OnClick and OnDblClick events:

If you need to test for the button or shift arguments, you can use constants listed in the table above for enumAMouseButton and enumAKeyShift.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

Note: You can use a OnMouseMove event procedure to respond to an event caused by moving the mouse. The button argument for OnMouseDown and OnMouseUp differs from the button argument used for OnMouseMove. For OnMouseDown and OnMouseUp, the button argument indicates exactly one button per event, whereas for OnMouseMove, it indicates the current state of all buttons.

Example

chk1.OnMouseUp(nButton, nShift, x, y)

{

If nButton = aMouseButtonLeft

then ....

endif

}

Applies to

 

AButton

AGroupBox

AScrollBar

AChart

AImage

ASlider

ACheckBox

ALabel

ASwitch

AComboBox

AListBox

ATextBox

AForm

ARadioButton

 

See Also

OnClick, OnDblClick, OnMouseDown, OnMouseMove