Distinguishing simple and double clicks
Richard Gaskin
ambassador at fourthworld.com
Tue Sep 23 11:48:04 EDT 2008
Eric Chatonet wrote:
> I just want to make something that was easy with HC: e.g. allow the
> user to use simple and double clicks on the same button but with
> different actions.
> MouseUp is always sent by the engine first then mouseDoubleUp is sent
> if appropriate.
Is that not how HyperCard works?
If HC sends only one message or the other, then it must be adding a
delay to the mouseUp before firing its mouseUp message in order to be
able to distinguish it from mouseDoubleUp. :\
As for the task itself, your handlers look good for what you want to do
so I'd go with those, but the question has me curious: What is it
you're working on?
I ask because when I read David Bovill's comment that this is a common
task, at first glance I thought so too but after thinking about it some
more I wonder if there's a subtle distinction at play here between
common and less common use of those two messages in a single control.
--
A little background for those who may not have considered the
abstraction of the "noun-verb" interaction model:
Most modern GUIs employ a noun-verb model, in which a noun object is
selected and then a verb object is selected which operates on that noun.
For example, when you select text you're specifying the "noun", and then
choosing "Bold" from the Style menu selects a "verb" (command) to
operate on that noun.
The double-click gesture is commonly used as a shortcut to selecting a
verb, and is generally handled in a noun object (see
<http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGUserInput/chapter_12_section_2.html#//apple_ref/doc/uid/TP30000361-TPXREF8>).
For example, in the Mac's Finder or Windows' Explorer, you can select an
icon (the noun) and then select File->Open (the verb), or as a shortcut
you can double-click the noun object to trigger that most common verb.
We also see this in list controls, where I tend to use mouseDoubleUp
most frequently, to trigger a default button.
For example, suppose you have a list picker dialog with three controls:
list field, "OK" button (default) and "Cancel" button. The explicit
way of working with the dialog is to select the item in the list (the
noun) then click "OK" (the verb), but it's common in many dialogs which
have a default button to trigger that default button when the user
double-clicks in the list as a shortcut.
In such selector controls I often have a mouseUp handler, but since it's
in a noun object it usually just updates the current view to reflect the
selection, rather than perform an action.
So while I can think of many examples of noun objects that use double
clicks as a short cut for selecting a verb object, offhand I can't think
of an example where a verb object handles double-clicks.
--
From your description it almost sounds like the control in question is
a verb object such as a command button, rather than a noun object such
as an icon or list item. Do I understand that correctly?
If so, what is it about the interaction that requires that?
Or to word it in a more solutions-oriented way, might a change to the UI
make for an interaction model which maintains the traditional
noun-verb expectation?
While not every difference between HC and Rev favors Rev, this is one
where perhaps Dr. Raney's doctorate in cognitive psychology may have
shown itself well: while HyperCard eats clicks on double-click (and
presumably introduces a delay to make that possible), Rev gives the
developer the freedom to handle them both, confident that in most cases
it'll be fine since it conforms to the most common interaction model.
Am I wearing rose-colored glasses on this? Are there common examples of
verb objects handling double-clicks that I've overlooked? (Sometimes
good coffee breeds unwarranted optimism <g>.)
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list