home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4398 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.6 KB

  1. Path: sparky!uunet!think.com!sdd.hp.com!spool.mu.edu!agate!doc.ic.ac.uk!np2
  2. From: np2@doc.ic.ac.uk (Nathaniel Pryce)
  3. Newsgroups: comp.windows.ms.programmer,comp.os.ms-windows.programmer.misc
  4. Subject: Re: How to distinguish between Click and Double-Click?
  5. Date: 21 Dec 1992 17:17:46 -0000
  6. Organization: Department of Computing, Imperial College, University of London, UK.
  7. Lines: 39
  8. Distribution: world
  9. Message-ID: <1h4u7qINNldc@oak1.doc.ic.ac.uk>
  10. References: <1992Dec16.194809.19535@kth.se> <1992Dec18.012228.3908@hplabsz.hpl.hp.com> <1992Dec18.131216.3058@cs.wayne.edu>
  11. NNTP-Posting-Host: oak1.doc.ic.ac.uk
  12.  
  13.  
  14. In article <1992Dec18.131216.3058@cs.wayne.edu>, pbh@pandora.cs.wayne.edu (Patrick B. Haggood) writes:
  15. |> Borland's OWL includes two Windows messages; WM_LBUTTONDBLCLK AND
  16. |> WM_RBUTTONDBLCLK.  See the OWL manual p.42 or any of a bunch of 
  17. |> third party books on OWL.
  18.  
  19. To have double click messages sent to a window, you must set the correct
  20. class style: CS_DBLCLICK I think, but I'm not sure of the exact name.
  21.  
  22. Windows deals with double clicks by sending four messages to the window:
  23. WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK & WM_LBUTTONUP. (for the
  24. left mouse button, for instance.) When the program receives the 
  25. WM_LBUTTONDBLCLK message, must handle the fact that the previous two messages 
  26. were part of the double click, as is the next button-up message. The latter 
  27. can be handles with a  boolean flag. 
  28.  
  29. The former is a little harder. I used double clicks to end the drawing of
  30. a multi-point line in an object-oriented drawing package (actually a garden
  31. designer). Every button up message added a point to the line, unless the last
  32. message processed was a double-click. When I received a double click message,
  33. I knew I had collected all the points and so processed them. Therefore I didn't
  34. need to deal with/remember the previous two button-down/button-up messages,
  35. since the double-click was an extension of a single-click; ie: single-click = 
  36. "new point", double-click = "last point". 
  37.  
  38. I have found that in practise, most uses of double clicks are like this. 
  39. Anything else is complicated to write and nasty to use.
  40.  
  41.  
  42.  
  43. |> -- 
  44. |> Patrick B. Haggood                Wayne State University
  45. |> "Again, the kingdom of heaven is like unto a net," | DoD #1966    
  46. |>     Matthew 13:47                              | pbh@prjup.uucp
  47. -- 
  48. -------------------------------------------------------------------------------
  49.   ///                     Nat Pryce (np2@doc.ic.ac.uk)                  
  50.  ( oo  It is essential to dig the most for if you do not dig you lose your
  51.  |\_|  superiority over the square and so are less likely to be cool - Kerouac
  52.