MouseDblClick Event

Purpose

Occur when the user double clicks a mouse button in a Form.

Syntax

Sub Form_MouseDblClick([index%,] button&, shift&, x!, y!)

Form:Form Object
button&, shift&:Short integer exp
x!, y!:Single exp

Description

Object - Returns an Form Ocx object expression.

index% - Returns an integer that uniquely identifies a Form if it's in an array.

button - Returns an integer that identifies the button that was pressed. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

shift - Returns 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. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y - Returns a number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Use a MouseDblClick event for a better response of a double click event in a Form. Unlike the DblClick event, the MouseDblClick event 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.

Example

OpenW # 1

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_MouseDblClick(Button&, Shift&, x!, y!)

Print "Mouse Double Click - Button: "; Button&

EndSub

 

Sub Win_1_DblClick()

Print "Double Click"

EndSub

Remarks

The following applies to both Click and DblClick events:

·If a mouse button is pressed while the pointer is over a form or control, that object "captures" the mouse and receives all mouse events up to and including the last MouseUp event. This implies that the x, y mouse-pointer coordinates returned by a mouse event may not always be in the internal area of the object that receives them.

·If mouse buttons are pressed in succession, the object that captures the mouse after the first press receives all mouse events until all buttons are released.

See Also

Form, Click, DblClick, MouseMove

{Created by Sjouke Hamstra; Last updated: 18/10/2014 by James Gaite}