Message Boards Message Boards

DynamicModule issues with Refresh, controls, CDF, and auto executing

Posted 10 years ago


I am in the middle of making a CDF for a collection of expensive calcuations and plots. I've gone with DynamicModule and have read the documentation but I've obviously missed a few things as it is not working as expected. The code below demonstrates my problem but the actual code of calcuations and plots is much, much larger.

  1. The controls created by the makeControl function for the dynamic variables do not display on first execution but everything else does. That is, if you
  • delete the output cell,
  • quit and then start the kernel,
  • and execute the module

then those controls show as the text of the commands that make them. Then executing the module a second time the controls show as the are supposed to. The plots and charts are linked to the update variable and refresh when the Run Simulation button is clicked on both the first evaluation and the second evaluation.

  1. The Dynamic@Refresh keeps kicking out a Null. If I end it with a ; then none of the plots and tables update when the Run Simulation button is pressed. This seems odd that making it not display output results in it not running the code inside. Is this a bug?

  2. When previewed as CDF Player I get a ton of errors from the FE' context when I click the Run Simulation button. I have SaveDefinitions -> True on the module so am not certain why this is happening.

  3. When the notebook window is moved the simulation runs repeatedly. Also, when CDF Player is previewed moving the window it is in causes the simulation to repeatedly run. This only happens in the CDF Player preview until the Run Simulation button is pressed. After it is pressed moving the window does not cause the simulation to run. It always runs in the notebook when the window is moved even after pressing the Run Simulation button. It is an expensive simulation so this behaviour is very much not desired.

Notebook is attached with code example that has all four issues.

POSTED BY: Edmund Robinson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract