The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Quirks of EventHandler
Replies: 3   Last Post: Nov 10, 2012 2:10 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
John Fultz

Posts: 736
Registered: 12/7/04
Re: Quirks of EventHandler
Posted: Nov 8, 2012 7:02 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In most user interfaces (okay, most is wishy-washy=85in every single
interface I have ever tried), a super-long-depressed click is still a
click. E.g., if you press and hold a button, then have a long cup of
coffee in your other hand, then let go of the button=85you clicked the
button. And, important point here, that button wasn't clicked until you
*let go* of the mouse. There's just no way at all that one can know
when the mouse goes down what the user will do; Mathematica is not [yet]
capable of predicting the future.

You seem to suggest that "regularizing" this would involve determining
which of MouseDown/MouseUp and MouseClicked should be passed, but I just
don't see how one can do that. You want the MouseDown event
immediately, not after some pregnant pause to try to suss out the user's
intent. And if we're giving you the MouseDown event, why would you
sometimes not want to see the MouseUp event?

John Fultz
User Interface Group
Wolfram Research, Inc.

On Nov 8, 2012, at 1:09 AM, wrote:

> I recently saw the following query from Hugh Goyder in the archive (excerpt follows):
> I am trying to work out how to
> get separate events from MouseDown, MouseDragged, MouseUp and
> MouseClicked. As far as I can see if the mouse is clicked this is also
> an event for MouseDown and MouseUp. Similarly however long I wait
> between a down and an up I get a click. How are you meant to separate
> out events if you are mixing downs, ups and clicks?
> I've been wrestling with this as well, and Hugh is right. The following example illustrates what's going on:
> DynamicModule[{col = Red, event = "nothing"},
> EventHandler[
> Graphics[{Dynamic[col], Disk[], White,
> Text[Dynamic[
> StyleForm[ToString[event],
> FontSize -> 36]]]}], {"MouseClicked" :> (Pause[1];
> event = "clicked"; col = Blue),
> "MouseDragged" :> (Pause[1]; event = "dragged"; col = Green),
> "MouseUp" :> (Pause[1]; event = "up"; col = Darker[Yellow]),
> "MouseDown" :> (Pause[1]; event = "down"; col = Black)}]]
> In summary, the issue seems to be that when you click the mouse, this instantiates first a MouseDown event, then a MouseUp event and only then a MouseClicked event. And as Hugh points out, even a prolonged depression of the mouse button counts as a click!
> I'm working on a workaround for my own application; probably knowing the order in which these events occur will help. Slightly knotty problem though, and I can't help feeling, knottier than it needs to be...
> Anyone know whether this behaviour will be regularised in 9?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.