🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2614

Re: How to distinguish between Click and Double-Click?

#2614
From: Nathaniel Pryce
Date: Mon, 21 Dec 1992 17:17
39 lines
2694 bytes
In article <1992Dec18.131216.3058@cs.wayne.edu>, pbh@pandora.cs.wayne.edu (Patrick B. Haggood) writes:
|> Borland's OWL includes two Windows messages; WM_LBUTTONDBLCLK AND
|> WM_RBUTTONDBLCLK.  See the OWL manual p.42 or any of a bunch of 
|> third party books on OWL.

To have double click messages sent to a window, you must set the correct
class style: CS_DBLCLICK I think, but I'm not sure of the exact name.

Windows deals with double clicks by sending four messages to the window:
WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK & WM_LBUTTONUP. (for the
left mouse button, for instance.) When the program receives the 
WM_LBUTTONDBLCLK message, must handle the fact that the previous two messages 
were part of the double click, as is the next button-up message. The latter 
can be handles with a  boolean flag. 

The former is a little harder. I used double clicks to end the drawing of
a multi-point line in an object-oriented drawing package (actually a garden
designer). Every button up message added a point to the line, unless the last
message processed was a double-click. When I received a double click message,
I knew I had collected all the points and so processed them. Therefore I didn't
need to deal with/remember the previous two button-down/button-up messages,
since the double-click was an extension of a single-click; ie: single-click = 
"new point", double-click = "last point". 

I have found that in practise, most uses of double clicks are like this. 
Anything else is complicated to write and nasty to use.



|> -- 
|> Patrick B. Haggood				Wayne State University
|> "Again, the kingdom of heaven is like unto a net," | DoD #1966	
|> 	Matthew 13:47                              | pbh@prjup.uucp
-- 
-------------------------------------------------------------------------------
  ///                     Nat Pryce (np2@doc.ic.ac.uk)                  
 ( oo  It is essential to dig the most for if you do not dig you lose your
 |\_|  superiority over the square and so are less likely to be cool - Kerouac
Technical Details
Message-ID: <1h4u7qINNldc@oak1.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!spool.mu.edu!agate!doc.ic.ac.uk!np2
References: <1992Dec16.194809.19535@kth.se> <1992Dec18.012228.3908@hplabsz.hpl.hp.com> <1992Dec18.131216.3058@cs.wayne.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!spool.mu.edu!agate!doc.ic.ac.uk!np2
From: np2@doc.ic.ac.uk (Nathaniel Pryce)
Newsgroups: comp.windows.ms.programmer,comp.os.ms-windows.programmer.misc
Subject: Re: How to distinguish between Click and Double-Click?
Date: 21 Dec 1992 17:17:46 -0000
Organization: Department of Computing, Imperial College, University of London, UK.
Lines: 39
Distribution: world
Message-ID: <1h4u7qINNldc@oak1.doc.ic.ac.uk>
References: <1992Dec16.194809.19535@kth.se> <1992Dec18.012228.3908@hplabsz.hpl.hp.com> <1992Dec18.131216.3058@cs.wayne.edu>
NNTP-Posting-Host: oak1.doc.ic.ac.uk