Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg123841] Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook
- From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
- Date: Thu, 22 Dec 2011 04:27:52 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Nasser, would you mind not cross posting MG and SO? Thanks, Oliver On Wed, 21 Dec 2011, Nasser M. Abbasi wrote: > I am finally able to reproduce this message that I get once in a while. > > This in on V8.04, on windows 7. > > While trying things, I found how to make Mathematica generate the above > message when I open a notebook with Manipulate in it. > > I will show the code that generated this message, and have > a follow up question on Dynamic module inside Manipulate. > > First the error message screen shot: > > http://12000.org/tmp/dec_20_2011/error_message.png > > I now hit 'enable dynamics' and all seems well. But each time > I reopen the notebook, I get the message again. > > So I do not understand this warning message, and why it comes up. > > The code to generate it is: > > -------------------------------------- > Manipulate[ > > DynamicModule[{p}, > p["x"] = 0; > Row[{Dynamic[ > Refresh[p["x"]++; Row[{"p[x]=", p["x"]}], > TrackedSymbols -> {n}]]}] > ], > > Button["update counter", n++], > {{n,0}, None} > ] > ----------------------------------------- > > The above is on its own notebook, with nothing else in the notebook. > > I close M, then start it, then open the notebook, and I see the above > message. > > Now, to remove the message, I found out that the use of p["x"] is > what seems to be causing it. Because I closed the above notebook, and > made a new notebook with this code: > > ------------------------- > Manipulate[ > > DynamicModule[{p}, > p = 0; > Row[{Dynamic[Refresh[p++; Row[{"p=", p}], TrackedSymbols -> {n}]]}] > ], > > Button["update counter", n++], > {{n, 0}, None} > ] > ----------------------------- > > Then closed M, and started it again, and opened the above notebook, > and now I do not see the warning message. > > The only difference is that one has p["x"] and the other has just p. > > So, why is using p["x"] causing the security warning message? > > p["x"] is an indexed object as explained in this page: > > http://reference.wolfram.com/mathematica/tutorial/MakingDefinitionsForIndexedObjects.html > > And now for the follow up question: In the second example above, where > the warning do not show up, I noticed that the value of 'p' is not saved > when I close the notebook. > > So that when I start the notebook again, I was expecting the counter, > which is the value of p,to be at the value it was before I closed > the notebook. This is because 'p' belongs to a DynamicModule[] (just > like Manipulate control variables keep the same state when one > closes the notebook and open it again.) > > What do I need to change in example 2 above to achieve this? I must > be doing something silly, I just do not see it now. > > thank you, > --Nasser > >