home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5331 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.8 KB

  1. Path: sparky!uunet!cs.utexas.edu!tamsun.tamu.edu!tnash
  2. From: tnash@cs.tamu.edu (Trey Nash)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Triple click - how to capture?
  5. Date: 25 Jan 1993 08:08:00 GMT
  6. Organization: Computer Science Department, Texas A&M University
  7. Lines: 25
  8. Message-ID: <1k0750INN1qf@tamsun.tamu.edu>
  9. References: <9302511.29120@mulga.cs.mu.OZ.AU>
  10. NNTP-Posting-Host: sparc71.cs.tamu.edu
  11.  
  12. Well, there are two ways to capture a double click within Windows.  The best
  13. way is to set the CS_DBLCLKS flag in the wndclass.style variable of the 
  14. WNDCLASS structure.  However, there is another way.  Whenever you receive
  15. a WM_LBUTTONDOWN (or any other button for that matter) message, you can use
  16. the GetMessageTime function to get the time of the action.  Then you can
  17. compare the intervals between the clicks to a required time to see if a double
  18. click was performed.  This is the way that you would want to process the
  19. triple click that you speak of.
  20.  
  21. However, one word of caution.  Usually, a double click message does something in
  22. addition to the single click message.  For instance, in WordPerfect for windows,
  23. the single click places the caret where you want it.  The double click will
  24. highlite a word.  And I believe that a triple click will highlite the sentence.
  25. You see, the functions sort of build on themselves.  For instance, you would
  26. not want the single click to select the place for the caret and then the
  27. double click to paste.  This is awkward and also places a burden on your
  28. mouse handling routine.  The reason is that before you get that WM_LBUTTONDBLCLK
  29. message, you would also receive a WM_LBUTTONDOWN message from the first click.
  30.  
  31. Just use GetMessageTime to compare the time interval from the previous click 
  32. and you will be OK.
  33.  
  34. Later.....
  35.  
  36.                         -Trey
  37.