1
$\begingroup$

I have a UI with DynamicModules. I have a progress bar, whenever the varibale progress updates, the DynamicModule reevaluates everything, making the UI extremely slow. Is there a way to disable dynamic updating when a certain variable is updated? Basically, when the progress bar is updating, I do not want to recalculate everything hundreds of times, but when other variables are updated, I want the DynamicModule to reevaluate.

$\endgroup$

closed as off-topic by Kuba, m_goldberg, Sjoerd C. de Vries, dr.blochwave, bbgodfrey May 22 '15 at 13:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, m_goldberg, Sjoerd C. de Vries, dr.blochwave, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ have a look at TrackedSymbols and possibly also Refresh $\endgroup$ – Mike Honeychurch May 22 '15 at 0:31
  • $\begingroup$ I had similar problem, the solution I opted for was actually making my UI faster by using compiled functions. I got the UI evaluation from 7s down to 0.2s. If you are not already doing that, try using Compiled functions and also if you Solve or Minimize for a numerical problem, try replacing them with FindRoot and FindMinimum (not NSolve and NMinimize), these are way faster ... $\endgroup$ – Bichoy May 22 '15 at 2:11
  • $\begingroup$ To answer your question, we would have to know how your progress bar is coupled to your other dynamic variables -- that is, we need to see your code. $\endgroup$ – m_goldberg May 22 '15 at 6:24
2
$\begingroup$

You can wrap the part that you want to be updated using Dynamic.

Check the difference between these two codes:

Manipulate[
 Graphics[{{Gray, 
    Line /@ Partition[RandomReal[{-4, 4}, {1000, 2}], 2]}, {Red, 
    Circle[{a, b}, c]}}], {a, 0, 1}, {b, 0, 1}, {c, 1, 4}]

Manipulate[
 Graphics[{{Gray, 
    Line /@ Partition[RandomReal[{-4, 4}, {1000, 2}], 2]}, 
   Dynamic@{Red, Circle[{a, b}, c]}}], {a, 0, 1}, {b, 0, 1}, {c, 1, 
  4}]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.