Re: How to lock down a Dynamic object in a report
- To: mathgroup at smc.vnet.net
- Subject: [mg128275] Re: How to lock down a Dynamic object in a report
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Wed, 3 Oct 2012 23:37:54 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
Is there a way to lock a Dynamic object so it does not respond to users? I know it sounds funny, but I have created a LocatorPane to organize items in a database. When I publish my weekly report as a CDF, the same LoacatoPane also serves as a nice graphic of the current state of the database. However, the reader can accidentally scramble the Locators or try to apply the changes to the database which of course serves up errors in CDFReader. Solutions that don't work: * Deploy only locks down editing of graphics, but controls still respond. * Publishing the report as a PDF won't work because I use cell grouping and OpenerViews elsewhere in the report. * Recreating the LocatorPane as a Graphic is undesirable because I put a lot of work into it, and I don't want to have to maintain two complex functions like that. So, is there a wrapper like Deploy that I can use around my LocatorPane when I want to publish it as a static object? Daniel Hi, Daniel, In addition to the answers of John and Albert I would like to show the approach I use. It includes a button however. The idea is that you introduce a global variable into the DynamicModule. Upon the button click this variable takes up the last value of your dynamic object, say, the dynamic database. Later this value may be evaluated in another cell or in another notebook. It will return the latest version of the database. But this will not be dynamic anymore. This is the one to publish. For example you may collapse the cell with input and dynamic output and only leave the one with the static output. To be specific I demonstrate it here using one graphic example from Menu/Help/LocatorPane. This is the example I have in mind as it is in Help: DynamicModule[{pts = {{0, 0}, {1, 1}, {2, 0}, {3, 2}}}, LocatorPane[Dynamic[pts], Dynamic[Plot[InterpolatingPolynomial[pts, x], {x, 0, 3}, PlotRange -> 3]]]] It returns a plot that one may adjust by moving four locators. Now, this is its modification: DynamicModule[{pts = {{0, 0}, {1, 1}, {2, 0}, {3, 2}}}, Column[{ LocatorPane[Dynamic[pts], Dynamic[Plot[InterpolatingPolynomial[pts, x], {x, 0, 3}, PlotRange -> 3] ] ], Spacer[5], (* The Button starts *) Button["Memorize the plot", Clear[plot]; plot = Plot[InterpolatingPolynomial[pts, x], {x, 0, 3}, PlotRange -> 3] ] (* End of the Button *) }] ] I introduced a button placed below the image returned by the dynamic module. The job of this button is to clear the global variable "plot" and to assign the current value of the graphics to this variable. If you now type the name of the variable plot in a separate cell and evaluate it, it returns the latest version of the graphics that is non-dynamic. Have fun, Alexei Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu