+ Reply to Thread
Results 1 to 4 of 4

userform label double-click goes to click event

  1. #1
    John Paul Fullerton
    Guest

    userform label double-click goes to click event

    Hi

    I have a VBA form that I'm using in Excel 2002. On one label in the form, I
    want to run one function from the click event and another from the
    double-click event. However, when I double-click the label, I always get the
    click event. I've checked the double-click speed from control panel and it
    seems to be ok. The form is *not* being shown modal.

    Have a nice day
    John Paul Fullerton


  2. #2
    Tom Ogilvy
    Guest

    Re: userform label double-click goes to click event

    That seems to be by design: (from help on dblClick)

    For this event to occur, the two clicks must occur within the time span
    specified by the system's double-click speed setting.
    For controls that support Click, the following sequence of events leads to
    the DblClick event:

    1. MouseDown
    2. MouseUp
    3. Click
    4. DblClick

    If a control, such as TextBox, does not support Click, Click is omitted fom
    the order of events leading to the DblClick event.

    Perhaps use Right Click for the second action.

    --
    Regards,
    Tom Ogilvy



    "John Paul Fullerton" <John Paul [email protected]> wrote
    in message news:[email protected]...
    > Hi
    >
    > I have a VBA form that I'm using in Excel 2002. On one label in the form,

    I
    > want to run one function from the click event and another from the
    > double-click event. However, when I double-click the label, I always get

    the
    > click event. I've checked the double-click speed from control panel and it
    > seems to be ok. The form is *not* being shown modal.
    >
    > Have a nice day
    > John Paul Fullerton
    >




  3. #3
    John Paul Fullerton
    Guest

    Re: userform label double-click goes to click event

    Thank you for the note.

    Could you let me know more about this?

    When I go to the form design screen, I can select dblclick for the label and
    I put code in that event (and other code in the click event). Eventually I
    just put msgbox's in both to let me know what event I was accessing. When I
    double-click the label when the macro is running and the form is displayed,
    it shows me the msgbox for the click event. I can consistently activate
    double-click in the control panel program, however not in macro. I can get
    access to the form's double-click event from double-clicking the form.

    Have a nice day
    John Paul Fullerton



    "Tom Ogilvy" wrote:

    > That seems to be by design: (from help on dblClick)
    >
    > For this event to occur, the two clicks must occur within the time span
    > specified by the system's double-click speed setting.
    > For controls that support Click, the following sequence of events leads to
    > the DblClick event:
    >
    > 1. MouseDown
    > 2. MouseUp
    > 3. Click
    > 4. DblClick
    >
    > If a control, such as TextBox, does not support Click, Click is omitted fom
    > the order of events leading to the DblClick event.
    >
    > Perhaps use Right Click for the second action.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "John Paul Fullerton" <John Paul [email protected]> wrote
    > in message news:[email protected]...
    > > Hi
    > >
    > > I have a VBA form that I'm using in Excel 2002. On one label in the form,

    > I
    > > want to run one function from the click event and another from the
    > > double-click event. However, when I double-click the label, I always get

    > the
    > > click event. I've checked the double-click speed from control panel and it
    > > seems to be ok. The form is *not* being shown modal.
    > >
    > > Have a nice day
    > > John Paul Fullerton
    > >

    >
    >
    >


  4. #4
    John Paul Fullerton
    Guest

    Re: userform label double-click goes to click event

    I found some code online that allows click and double click

    Dim isClick As Boolean

    Private Sub Label1_Click()
    Dim t As Single
    isClick = True
    ' Wait for the second click for half a second.
    t = Timer
    Do
    DoEvents
    ' If the DblClick procedure canceled this event,
    ' bail out.
    If Not isClick Then Exit Sub
    ' The next test accounts for clicks just before midnight.
    Loop Until Timer > t + 0.5 Or Timer < t
    ' Do your single-click processing here.
    MsgBox "click"
    End Sub

    Private Sub Label1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    ' Cancel any pending click.
    isClick = False
    ' Do your double-click processing here.
    MsgBox "double-click"
    End Sub

    Have a nice day
    John Paul Fullerton



    "Tom Ogilvy" wrote:

    > That seems to be by design: (from help on dblClick)
    >
    > For this event to occur, the two clicks must occur within the time span
    > specified by the system's double-click speed setting.
    > For controls that support Click, the following sequence of events leads to
    > the DblClick event:
    >
    > 1. MouseDown
    > 2. MouseUp
    > 3. Click
    > 4. DblClick
    >
    > If a control, such as TextBox, does not support Click, Click is omitted fom
    > the order of events leading to the DblClick event.
    >
    > Perhaps use Right Click for the second action.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "John Paul Fullerton" <John Paul [email protected]> wrote
    > in message news:[email protected]...
    > > Hi
    > >
    > > I have a VBA form that I'm using in Excel 2002. On one label in the form,

    > I
    > > want to run one function from the click event and another from the
    > > double-click event. However, when I double-click the label, I always get

    > the
    > > click event. I've checked the double-click speed from control panel and it
    > > seems to be ok. The form is *not* being shown modal.
    > >
    > > Have a nice day
    > > John Paul Fullerton
    > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1