Article View: comp.windows.ms.programmer
Article #2620Re: How to distinguish between Click and Double-Click?
From: Tom W. Brown
Date: Fri, 18 Dec 1992 18:43
Date: Fri, 18 Dec 1992 18:43
37 lines
2611 bytes
2611 bytes
In article <1992Dec18.012228.3908@hplabsz.hpl.hp.com>, yefchak@hplabsz.hpl.hp.com (George Yefchak) writes: |> Are the second opinions on that? I think I've seen software |> which does seem to be able to distinguish between single |> and double clicks as described above. (Actually, I've |> wanted to know how to do that too...) In particular, |> on the Mac you have only one button, so this ability seems |> pretty important there. The problem is that you will always get a WM_LBUTTONDOWN/WM_LBUTTONUP combination before getting the WM_LBUTTONDBLCLK message -- likewise for controls like a listbox you will always get the LBN_SELCHANGE before you get the LBN_DBLCLK notification. The only way I can think to really distinguish between single and double clicks would be to set a timer when you get the first click and if you _don't_ get a double click notification within some period of time then you assume it must have been a single click and only then take the appropriate action for a single click. Just thinking about trying to make this work properly for all cases and users makes me feel slightly nauseated though. A double click should only perform an action that is an extension of whatever a single click does, anything else would be confusing and cause endless annoyance. I'm not a Mac user, but I'll bet that even there it is a very rare case where a double click does something completely unrelated to a single click. I think the suggestion that modifier keys (CTRL, ALT, SHIFT) be used to distinguish between different actions on a click is the best way to go unless you want to introduce "mouse modes" in your application where the current mode determines the action of a click. ---------------------------------------------------------------------------- Tom Brown | "She turned me into a newt... PE Nelson Systems | ... I got better" twbrown@pe-nelson.com | Monty Python and the Holy Grail ----------------------------------------------------------------------------
Technical Details
Message-ID:
<722@lax.lax.pe-nelson.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrownReferences:
<1992Dec16.194809.19535@kth.se> <1992Dec18.012228.3908@hplabsz.hpl.hp.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown From: twbrown@PE-Nelson.COM (Tom W. Brown) Newsgroups: comp.windows.ms.programmer,comp.os.ms-windows.programmer.misc Subject: Re: How to distinguish between Click and Double-Click? Message-ID: <722@lax.lax.pe-nelson.com> Date: 18 Dec 92 18:43:58 GMT References: <1992Dec16.194809.19535@kth.se> <1992Dec18.012228.3908@hplabsz.hpl.hp.com> Sender: news@lax.pe-nelson.com Followup-To: comp.windows.ms.programmer Organization: PE-Nelson Lines: 37