handle doubleclick without handling click

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Boni

    handle doubleclick without handling click

    Dear all,
    I am interested in mouse down and double click events of a control.
    When doubleclick happens the processing for mouse down should't be done
    I did follwing:
    sub MyMouseDown(.) handles MouseDown(..)
    if e.clicks>1 then return 'This is double click <-----------------(*)
    ....
    end sub
    sub DoubleClick(.) handles DoubleClick(..)
    end sub

    unfortunately when doubleclick happens the simple click seems to happen too.
    So (*) don't filter out double clicks.
    What is a proper way to handle this problem?
    Thanks,
    Boni


  • Herfried K. Wagner [MVP]

    #2
    Re: handle doubleclick without handling click

    "Boni" <oilia@nospam > schrieb:[color=blue]
    > I am interested in mouse down and double click events of a control.
    > When doubleclick happens the processing for mouse down should't be done
    > I did follwing:
    > sub MyMouseDown(.) handles MouseDown(..)
    > if e.clicks>1 then return 'This is double click <-----------------(*)
    > ...
    > end sub
    > sub DoubleClick(.) handles DoubleClick(..)
    > end sub
    >
    > unfortunately when doubleclick happens the simple click seems to happen
    > too.[/color]

    This behavior is by design. Otherwise it would be impossible to raise the
    'Click' event directly after the click is performed by the user.
    [color=blue]
    > What is a proper way to handle this problem?[/color]

    You could check if the time distance between the first and the second click
    is greater than 'SystemInformat ion.DoubleClick Time', and raise the 'Click'
    event after the period has elapsed and no consecutive click was performed.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Dennis

      #3
      Re: handle doubleclick without handling click

      For a double click be considered a "double-click", the mouse must be clicked
      twice within the System.Informat ion.DoubleClick Time property and within the
      System.Informat ion.DoubleClick Size area.

      The MouseEventArgs has a property that lets you detect the number of clicks
      within these parameters, i.e., MouseEventArgs. Clicks.
      --
      Dennis in Houston


      "Herfried K. Wagner [MVP]" wrote:
      [color=blue]
      > "Boni" <oilia@nospam > schrieb:[color=green]
      > > I am interested in mouse down and double click events of a control.
      > > When doubleclick happens the processing for mouse down should't be done
      > > I did follwing:
      > > sub MyMouseDown(.) handles MouseDown(..)
      > > if e.clicks>1 then return 'This is double click <-----------------(*)
      > > ...
      > > end sub
      > > sub DoubleClick(.) handles DoubleClick(..)
      > > end sub
      > >
      > > unfortunately when doubleclick happens the simple click seems to happen
      > > too.[/color]
      >
      > This behavior is by design. Otherwise it would be impossible to raise the
      > 'Click' event directly after the click is performed by the user.
      >[color=green]
      > > What is a proper way to handle this problem?[/color]
      >
      > You could check if the time distance between the first and the second click
      > is greater than 'SystemInformat ion.DoubleClick Time', and raise the 'Click'
      > event after the period has elapsed and no consecutive click was performed.
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>
      >
      >[/color]

      Comment

      Working...