DynamicModule values not saved correctly in "docked" cells?
- To: mathgroup at smc.vnet.net
- Subject: [mg131564] DynamicModule values not saved correctly in "docked" cells?
- From: Chris Osborn <chrisosb at gmail.com>
- Date: Mon, 2 Sep 2013 02:47:30 -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
It appears that for a DynamicModule expression in a "docked" cell, symbol assignments are not correctly saved when saving the associated notebook. In particular, when I save, close, and then reopen such a notebook, I find that the value assigned to each DynamicModule symbol is the initial value assigned to it, and not the value it had when the notebook was saved. Is this behavior expected? I have written some code, included below, to demonstrate this issue (tested on Mathematica 9.0.1.0). The code creates a new notebook with one docked cell and one non-docked cell. Both cells have DynamicModule expressions with a single variable in them, and have buttons that increment the value of their respective variables. To reproduce my issue: 1. Execute the code I give below 2. In that notebook that is created, click the button in each cell a few times, causing the values displayed in the buttons to increase by 1 each time 3. Save the notebook and close it 4. Re-open the notebook The value in the non-docked cell will be as expected; the value in the docked cell will be the original value (before clicking the button.) Here is the code: ClearAll[content]; content[] := DynamicModule[{x}, x = Random[]; Button[Dynamic[x], x++] ]; CreateDocument[ {content[]}, DockedCells -> Cell[BoxData@ToBoxes@content[], "DockedCell"] ]; Much thanks in advance for any suggestions! Thanks, Chris
- Follow-Ups:
- Re: DynamicModule values not saved correctly in "docked" cells?
- From: John Fultz <jfultz@wolfram.com>
- Re: DynamicModule values not saved correctly in "docked" cells?