Prev: DynamicModule and FileNameSetter problem
Next: Computation of cross correlation between two signals
From: Hugh Goyder on 7 Jun 2010 08:06 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 ] ]
|
Pages: 1 Prev: DynamicModule and FileNameSetter problem Next: Computation of cross correlation between two signals |