In a particular notebook, I've got a docked cell with a status readout that depends on a package I've written. It doesn't display properly before the package is loaded. The notebook has an initialization cell that loads the package, but of course that won't happen until the user explicitly evaluates initialization cells or evaluates something else and is prompted to evaluate such cells. To avoid a broken display, the package sets a global variable when loaded, and the docked cell has a Dynamic object that monitors this global variable, displaying "Please evaluate initialization cells!" when it's undefined and the normal status readout when its defined.
This works as intended when opening the notebook, but if the user quits the kernel with Quit[] or the menu item, the Dynamic object does NOT seem to notice, and so continues showing the status readout as if everything were normal. I need a way to make the Dynamic content change when the kernel quits, so the user knows he/she needs to evaluate initialization cells again.
This is more of an issue than it might seem, because (a) I'm working with very novice users, and (b) the notebook has other interactive features (like a big important button) that fail silently and confusingly when the package has not been loaded.
I get that Dynamic objects probably can't react sensibly to a kernel quit because the kernel is what makes them be responsive... So can anyone suggest any clever hacks that will let me change a displayed text item when the kernel quits?
$Epilog? You might be able to set that so it will set some flag and update your dynamic object before quitting. – N.J.Evans Sep 14 '15 at 20:18Initializationoption toDynamicand call the package in thatInitializationwithin theDynamicin your docked cell. – Mike Honeychurch Sep 16 '15 at 00:10$Epilogas suggested by N.J.Evans, and it's mostly working for me. Sometimes the docked cell's state isn't updating as it should, but I haven't had the bandwidth to dig in and figure out why. (This was for a course-in-progress this past semester, so I was scrambling to keep ahead of the students. Now that the term has ended, the pressure is off, and I can cook up a better framework for next time I teach this course.) – ibeatty Dec 16 '15 at 01:15