Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Understanding EventHandler
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Goyder Dr HGD

Posts: 59
Registered: 1/29/05
Understanding EventHandler
Posted: Jun 7, 2010 8:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Below I show two nested EventHandlers. 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?

Thanks

Hugh Goyder


DynamicModule[{i = 0, Flag = {}, history = {}},
EventHandler[
EventHandler[Column[{Dynamic[Graphics[{}, Frame -> True]],
Row[{"Current event = ", Dynamic[Flag]}],
Row[{"History = ", Dynamic[history]}]}],
{"MouseClicked" :> (++i;Flag = StringJoin[ToString[i], "
clicked"];AppendTo[history, Flag])},
PassEventsUp -> False],
{"MouseDown" :> (++i; Flag = StringJoin[ToString[i], "
down"];AppendTo[history, Flag]),
"MouseDragged" :> (++i;
Flag = StringJoin[ToString[i], " drag"];AppendTo[history,
Flag]),
"MouseUp" :> (++i; Flag = StringJoin[ToString[i], "
up"];AppendTo[history, Flag])},
PassEventsDown -> False
]
]




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.