MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Quirks of EventHandler

  • To: mathgroup at
  • Subject: [mg128623] Re: Quirks of EventHandler
  • From: "Ramsden, Philip J" <p.ramsden at>
  • Date: Sat, 10 Nov 2012 02:09:12 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <>

Hi John,

Thought you might be interested: as it turned out, a quick

PassEventsDown -> <predicate function of the parameters>

together with some fairly trivial tweaking, seemed to fix just about all my issues, and has had the additional benefit that I now sort of understand what this option does...

Very nice Manipulate now.

Best, Phil

-----Original Message-----
From: John Fultz [mailto:jfultz at]
Sent: 08 November 2012 14:34
To: Ramsden, Philip J
Cc: mathgroup at
Subject: [mg128623] Re: Quirks of EventHandler

In most user interfaces (okay, most is 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 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
jfultz at
User Interface Group
Wolfram Research, Inc.

On Nov 8, 2012, at 1:09 AM, p.ramsden at 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?

  • Prev by Date: piecewise and if
  • Next by Date: Re: Export a graphical plot to pdf file
  • Previous by thread: Re: Quirks of EventHandler
  • Next by thread: NonlinearModelFit properties are (suddenly) Missing[]