Experts,
I can't figure out why the Manipulate expression is being evaluated 2 times each time I click on the 'StepRightButton' which is part of a Trigger control.
When I click on the '+' button, I see the counter going up once as expected, but the expression is being evaluated 2 times, not one time 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, clicking on '+' shows the 'currentTime' variable is being increased by the correct amount (0.1 in this example). But my question is, why is the expression being evaluated twice by the evidence that the Date[] printed can be seen to increment 2 times per each click on '+' button.
This causes me problem, as I was assuming the expression will evaluate once per 'tick'.
Is this a way to make sure the expression is evaluated once each time I click on '+' once?
thanks,
This can be solved by adding the option PerformanceGoal -> "Quality"
to the Plot
function.
During the display of manipulated items a lower fidelity sample of the object can be shown depending on the PerformanceGoal
setting. A higher fidelity version is drawn at the end of the manipulation, if necessary. It is this later redrawing which seems to be causing the problem here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With