2
$\begingroup$

This question already has an answer here:

When I shorten the sections so I can get the input (slider bar) and out put on the page, Dynamic no longer works. Dynamic only works if you keep all the sections open. Is this a bug or is this supposed to happen?

$\endgroup$

marked as duplicate by Kuba, Yves Klett, Edmund, user9660, MarcoB May 31 '16 at 13:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ It's supposed to, Dynamic is only taken care of if it is visible. $\endgroup$ – Kuba May 27 '16 at 10:55
1
$\begingroup$

I thought this info is somewhere on top of tutorials or a Dynamic documentation, it isn't so let me add this answer:

tutorial / AdvancedDynamicFunctionality / Automatic Updates of Dynamic Objects

[...]

Dynamic outputs are only updated when they are visible on screen.

[...]

Outputs that are scrolled off-screen, above or below the current document position, will be left unexamined until the next time they are scrolled on-screen, at which point they are updated before being displayed.

(Thus the fact that they stopped updating is not normally apparent, unless they have side effects, which is discouraged in general.)

The last sentence means that it is discouraged to do something like

Dynamic[calculations and result]

You should design your GUI such way that you only have Dynamic[result] while calculations are triggered by something stable, like events in EventHandler, Buttons or other controllers. Or even NotebookDynamicExpressions.

$\endgroup$
0
$\begingroup$

Try to shorten the input only by double-clicking on the output, NOT input, "cell designator" or whatever those lines on the right are called. Make sure you double-click on the leftmost one, i.e. the output cell designator. I think, this way, your Dynamic stays active.

$\endgroup$
  • $\begingroup$ I see, let me see if I can figure out how to keep it activated. I think they might have an option for it. $\endgroup$ – Milad P. May 31 '16 at 1:15

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