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: 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?


Hugh Goyder

DynamicModule[{i = 0, Flag = {}, history = {}},
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,
"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]

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