DynamicModule Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg131389] DynamicModule Problem
- From: "djmpark" <djmpark at comcast.net>
- Date: Thu, 18 Jul 2013 02:59:07 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
I would like to have a DynamicModule (in a palette) with a Checkbox that
controlled a Global` variable and that would in turn indicate the state of
the Global variable if it was changed from within the notebook.
Actually, I can do that, but I would also like it to survive quitting and
restarting the Kernel - while leaving the notebook open. That I don't know
how to do. The actual problem is updating the DynamicModule variable from
the notebook. So here is a simple attempt where all I try to do is update
the DynamicModule display from the notebook.
systemState = False;
systemState = True;
DynamicModule[
{outsideState},
Dynamic[Refresh[outsideState, TrackedSymbols -> {outsideState},
UpdateInterval -> 0.9]],
Initialization :> (outsideState := Global`systemState)
]
If I evaluate one of the systemState cells and then the DynamicModule to
create the dynamic display cell, I can flip the display back and forth by
subsequent evaluations of the systemState cells. If I Quit the kernel the
display changes to 'systemState'. If I then evaluate one of the systemState
cells, restarting the kernel, it behaves properly (for me) and I can again
flip the display.
But if I Quit and restart a second time it won't work. If I copy the dynamic
cell it works and if I close and reopen the notebook it works. But I don't
want to do those things and I don't know how to reliably recover from just
quitting and restarting the kernel.
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/index.html