Question about trigger and update of Manipulate expression

Experts

I can’t understand why the Manipulate expression is evaluated 2 times every time I click the "StepRightButton" button, which is part of the trigger control.

When I click the "+" button, I see that the counter grows once as expected, but the expression is evaluated 2 times, and not once, as expected. Here is a small example

Manipulate[ Show[ Graphics@Text @Row[{currentTime," ",Date[]}], Plot[Sin[x],{x,-Pi,Pi}] ], Control[{{currentTime,0,Style["run",10]},0,100,0.1, ControlType->Trigger,DisplayAllSteps->True,ImageSize->Tiny, AnimationRate->Automatic,AnimationRepetitions->0, AppearanceElements->{"PlayButton","PauseButton","StepRightButton","ResetButton"}} ], ContinuousAction->False, SynchronousUpdating->False ] 

again, by pressing "+", the variable "currentTime" is increased by the correct amount (0.1 in this example). But my question is why is an expression that is evaluated twice by proving that the printed date [] can increase 2 times for every click on the + button.

This causes me a problem because I assumed that the expression would be evaluated once per tick.

Is this a way to make sure the expression is evaluated once every time I press the "+" once?

thanks,

+4
source share
1 answer

This can be solved by adding the PerformanceGoal -> "Quality" option to the Plot function.

During the display of controlled items, lower fidelity of an object may be displayed depending on the PerformanceGoal setting. If necessary, a version with higher accuracy is displayed at the end of the manipulation. It is this subsequent redrawing that seems to be causing the problem here.

+7
source

All Articles