MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Default value for Dynamic InputField

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83251] Re: Default value for Dynamic InputField
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 16 Nov 2007 05:26:13 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fhh7ku$8r4$1@smc.vnet.net>

robert prince-wright wrote:
> Can someone tell me how to set default values for Dynamic input fields:  I have tried Initialization with no success. 
> 
> Here is the generic code:
>   
>  InputField[ Dynamic[ R0] ]
>   
>  The intent is to assign a default value to the symbol R0 so that gets assigned each time the notebook is opened. The code below does not work for me!
>   
>  InputField[ Dynamic[ R0, Initialization:-> (R0=123)] ]
------------------------------------------^^^
Syntax Error: Either use Rule, -> , or RuleDelayed, :>, but not any 
mixture of both!

The following works fine on my system:

In[1]:= InputField[Dynamic[R0, Initialization -> (R0 = 123)]]

Out[1]= \!\(\*
InputFieldBox[Dynamic[$CellContext`R0, Initialization -> 123]]\)

In[2]:= $Version

Out[2]= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

You can get the notebook as well as a pdf file at

http://homepages.nyu.edu/~jmg336/mathematica/RPWInputField.nb

http://homepages.nyu.edu/~jmg336/mathematica/RPWInputField.pdf

HTH,
-- 
Jean-Marc


  • Prev by Date: Piecewise inside a Module or Block, I don't understand this behavior.
  • Next by Date: Re: Minimizing Mathematica file size for source code control?
  • Previous by thread: Re: Default value for Dynamic InputField
  • Next by thread: Re: Default value for Dynamic InputField