From: Alexei Boulbitch on 22 Apr 2010 03:31 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 -- Alexei Boulbitch, Dr., habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.
From: John Fultz on 23 Apr 2010 03:48 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(a)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
From: David Park on 24 Apr 2010 04:00 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(a)comcast.net http://home.comcast.net/~djmpark/ From: John Fultz [mailto:jfultz(a)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(a)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
From: John Fultz on 24 Apr 2010 04:00 The menu item, as I indicated, also applies to counters, where the motivation may be a little clearer. To answer some of your other questions... * Yes, it is one-way. * It does not work only on Output cells. I'm not sure why you think it does (I just trivially tested Text and Input cells for both Dynamics and counters where it performed flawlessly). * Yes, I agree that literalizing a control in a user interface isn't a very good application of the menu item. It should be said that, in further private correspondence, it turns out that converting Dynamics to literal really wasn't what the original poster wanted at all. His literal question reflected a suboptimal approach to solve the real problem he had, which I have since, hopefully, helped him to solve by better means (the email discussion isn't finished as I write this, so we'll see). Sincerely, John Fultz jfultz(a)wolfram.com User Interface Group Wolfram Research, Inc. On Fri, 23 Apr 2010 08:44:58 -0400, David Park wrote: > 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(a)comcast.net > http://home.comcast.net/~djmpark/ > > > From: John Fultz [mailto:jfultz(a)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(a)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
|
Pages: 1 Prev: Download as Live Mathematica from Wolfram|Alpha Next: Line changes length in animation |