MathGroup Archive 2010

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

Search the Archive

Understanding EventHandler

  • To: mathgroup at
  • Subject: [mg110187] Understanding EventHandler
  • From: Hugh Goyder <h.g.d.goyder at>
  • Date: Mon, 7 Jun 2010 08:06:12 -0400 (EDT)

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

  • Prev by Date: Re: Big memory needed
  • Next by Date: Re: Big memory needed
  • Previous by thread: Assumptions, Abs, etc.
  • Next by thread: FullSimplify and negative radicands