"stopping" does not appear because the button parses the entire CompoundExpression
in the second argument. For example,
DynamicModule[{state = 1}, Column[{Dynamic[state], Button["Trigger", state = 2; Pause[1]; state = 3]}]]
only updates with "3". I'm not sure why you're using UpdateInterval
in your dynamics. If the dynamic is only a wrapper, then usually you want that to update as fast as possible.
I would suggest using EventHandler
. It's a lower-level function, but you can use it to separate out the updates to MouseDown
versus MouseUp
events:
EventHandler[Button["Trigger", Print["A"], Active -> False], {"MouseDown" :> Print["B"], "MouseUp" :> Print["C"]}]
In the above code I still use a Button
so you get a similar interface, but I disable the button's action. By putting your "stopping" update with MouseDown
and the rest in MouseUp
, you should get your interface to update as you want. Better still, you can make the button not do anything except change its appearance when clicked:
Column[{
Dynamic[state],
EventHandler[Button["Trigger", Null], {"MouseDown" :> (state = 2), "MouseUp" :> (state = 3)}, PassEventsDown -> True]
}]