Triple Clicking a Mouse

Tags:
Development
Its very simple... How can I recognise a triple mouse click in VB.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hm. Have never had to do this. Interesting idea.

You’ll have to recognize this using brute force (i.e. programming). Windows provides messages for single clicks and double clicks. You will have to recognize single clicks, starting a timer when the first one occurs, then making sure the second and third clicks arrive (from the same position as the first, or at least close to the first position) with in a suitable time period, like 1/2 to 3/4 second.

Phil

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Lpgast
    Mouse clicks are actually messages generated by the windows message class. from my experience, and it's been a while, but I don't think that there is a message for "TRIPLE CLICKS". So, short of sub classing the entire MSG class and altering the event, I don't think it's possible. P.S. in regards to the above response, there is a shit load more to it than that. What about overlapping windows? Hidden Areas? etc. The mesage class events are so embedded in the OS, trying to create your own event in such a trivail manner won't work. IMHO;) P.P.S. What is it you are trying to accomplish? maybe there is a better/existing method?
    0 pointsBadges:
    report
  • VenPhil
    Well, it isn't as complicated as lpgast implies. You aren't inventing a new Windows message, but using an existing one. If you define a single-click event handler for the class your control is in, the only time you will receive that event is when the mouse is clicked within that window. No problem. All you are doing is looking at single-click events for a particular control, which we do all the time. Then you see if a series of these (three) take place within a particular time period that would represent a triple-click. Phil
    0 pointsBadges:
    report
  • Lpgast
    Not to beat a dead horse, or go off on rant.... but windows detects mouse clicks at the os level, it will never confuse a single click with a double click, that's because it detects the double click as two clicks within microsends and with neglibale mouse movements. Trapping two single clicks is not the same thing as a double click. So to that for a triple click means you have to trap three single clicks in sussesion while not triggering the double click(becuse that would cancel your new event). My point to this is although it may be possible to acheive, it may not be efficeint or reliable. Years ago when my company at the time started using windows (3.11) and MS Access(1.0), none of our users were familiar with working with windows, (we were an strict AS/400 shop till then), so they all had problems with the double click, so the access guys tried to force acces into responding to two single clicks as a double clicks for users with slow fingers. Short story, it never worked reliably, windows would interject with it's own view of situation and trigger single or double the way it is supposed to. So again while may certainly possible it think it would reliable, easy or necessary for that matter.
    0 pointsBadges:
    report
  • Lpgast
    OK. after posting (and since I feel like being LAZY today), I went online and did a search on the topic. I found these articles which A. describe the mose click event structure, and B. works though a method of increasing mouse click detenction. I'd like to point out that this is A. written in C code and not VB, and B. this definitely falls into subclasing. Although VB has come along way I don't how well it will perform subclasing such a non-trivial aspect of windows. As the author of the article points out and describes it can be done, but with VB I'm not sure. http://blogs.msdn.com/oldnewthing/archive/2004/10/15/242761.aspx http://blogs.msdn.com/oldnewthing/archive/2004/10/18/243925.aspx and just so you don't think I am anti-VB, I developed VB apps for well over 8 years. I only stopped PROFESIONAL developement with it when VB.NET came into the picture. (actualy I am still mostly an AS/40O developer, and the shops I work for have moved away from VB and started using more WEB developemnet tools such as WEBFocus, etc.)
    0 pointsBadges:
    report
  • Tmehta
    HI, I don't know if this helps - I know of at least 2 applications that use triple clicks extensively - WordPerfect and STP (System Tray Player) with STP being ahead (it uses left AND right key clicks) I am not certain it can be done in VB though. The issue of this being a low-level interface in the OS is valid and therefore would need some careful handling. Bye
    0 pointsBadges:
    report
  • Littlew
    I've managed to do this in vba using both double click and single click events so hopefully this might help you: create a global variable blTimer as Boolean I created a text box(Text0) and then added the following events to the form/textbox Private Sub Form_Timer() blTimer = False Me.TimerInterval = 0 End Sub Private Sub Text0_Click() If blTimer = True Then MsgBox ("Triple Click") End Sub Private Sub Text0_DblClick(Cancel As Integer) Me.TimerInterval = 500 blTimer = True End Sub :)
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: