DblClick Event

Purpose

Occurs when the user presses and releases a mouse button and then presses and releases it again over an object.

Syntax

Sub object_DblClick ([index As Integer])

object:Ocx Object
index:iexp

Description

For a form, the DblClick event occurs when the user double-clicks a disabled control or a blank area of a form. For a control, it occurs when the user:

  • Double-clicks a control with the left mouse button.
  • Double-clicks an item in a ComboBox control whose Style property is set to 1 (Simple) or in a ListBox.
  • The argument Index uniquely identifies a form or control if it's in a form or control array. You can use a DblClick event procedure for an implied action, such as double-clicking an icon to open a window or document. You can also use this type of procedure to carry out multiple steps with a single action, such as double-clicking to select an item in a list box and to close the dialog box.

    Example

    Form frm1 = "(Dbl)Click Event", 20, 20, 300, 300

    Ocx Command cmd(1) = "cmd1", 10, 10, 80, 24

    Ocx Command cmd(2) = "cmd2", 10, 40, 80, 24

    Ocx Command cmd(3) = "cmd3", 10, 70, 80, 24

    Do

    Sleep

    Until Me Is Nothing

     

    Sub cmd_Click(Index%)

    Text 100, 30, "Click at " + Str(Index)

    EndSub

     

    Sub cmd_DblClick(Index%)

    Text 100, 30, "DblClick at " + Str(Index)

    EndSub

    Remarks

    For those objects that receive Mouse events, the events occur in this order: MouseDown, MouseUp, Click, DblClick, and MouseUp.

    To distinguish between the left, right, and middle mouse buttons, use the MouseDblClick event.

    See Also

    Form, MouseDown, MouseDblClick, Click

    {Created by Sjouke Hamstra; Last updated: 28/09/2014 by James Gaite}