I want to do something when the mouse is clicked. But it shouldn't matter where the mouse is clicked, so I can't use EventHandler
. Instead, I'm trying to do it like this:
DynamicModule[{i = 0},
WhenEvent[ControllerState["Button 1"], i = i + 1]
i]
WhenEvent
is not the right function. What I want is a function that will do something when ControllerState["Button 1"]
switches from false
to true
.
DynamicModule[{i = 0}, Dynamic[If[ControllerState["Button 1"], (i = i + 1)]; i]]
. I think you'll find it doesn't quite behave right. It's really more like a mouse-down event, than a mouse-click. Perhaps that's what you want $\endgroup$Dynamic
only keeps some visible output up to date. So, whatever you do withDynamic
, in the best case scenario it will only work when it is visible. Is that what you want? $\endgroup$NotebookEventActions
, orNotebookDynamicExpression
$\endgroup$