I am creating an interface which needs to repeat an operation every few seconds. The operation itself is expensive but faster than the update interval of the interface.
I would like to have some visual feedback to know every time the operation starts and ends but I have not been able to find a solution that works well.
This is what I have now:
expensive[k_] := (Pause[2]; k + 1)
DynamicModule[{k = 0, status = "not calculating"},
{
Dynamic[
Refresh[status = "calculating";
k = expensive[k];
status = "not calculating",
UpdateInterval -> 5, TrackedSymbols :> {}]],
Dynamic[{status, k}, TrackedSymbols :> {status}]
}
]
Does anyone know how why it is not working and how to fix it?
This question is related to Showing "updating..." message while Manipulate is re-evaluating but the refresh is triggered by an UpdateInterval instead of a button.