Re: How to make make a Dynamic variable to become an ordinary one
- To: mathgroup at smc.vnet.net
- Subject: [mg109389] Re: How to make make a Dynamic variable to become an ordinary one
- From: "David Park" <djmpark at comcast.net>
- Date: Sat, 24 Apr 2010 04:03:28 -0400 (EDT)
I'm just wondering what the rationale is for this menu item? Wouldn't there be better and more natural methods for doing this kind of thing, at least in a dynamic presentation? The DC help gives only barely more information and no examples. Is this a one-way operation? Is there any way to go back? Apparently this only works on Output cells (although Help doesn't say that). Perhaps this might be used to capture a particular dynamic value that had been adjusted to one's satisfaction but I don't see how one would do that without doing an actual copy and paste of the value. I could imagine that in a dynamic presentation one might have a control that one might temporarily want to fix while other controls perhaps are activated. But this could be done with a Button or perhaps a Toggler. I don't see why "Convert Dynamic to Literal" rises to the level of a Menu item, or even why it is very usable. Maybe someone can show a neat example. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: John Fultz [mailto:jfultz at wolfram.com] If you use SelectionMove[] to make sure the Dynamic thing is selected, then you can evaluate the following code: FrontEndExecute[ FrontEnd`NotebookDynamicToLiteral[NotebookSelection[nb]]] where nb is the appropriate NotebookObject. This will literalize *everything* in the selection, which includes not just Dynamics, but also counters. You could also literalize an entire notebook using this formulation... FrontEndExecute[FrontEnd`NotebookDynamicToLiteral[nb]] Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Thu, 22 Apr 2010 03:31:27 -0400 (EDT), Alexei Boulbitch wrote: > Dear Community, > > I have an interactive program, where I am using a Dynamic variable. In > some point I would like to transform this variable to an ordinary one > (e.g. I would like that the variable does not change dynamically any > more). Such an operation can easily be done by Menu/Evaluation/Convert > dynamic to literal. I would like however, to do the same > programmatically (say, upon pressing a Button). What command does the > job? > > Best, Alexei