MathGroup Archive 2013

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

Search the Archive

ensuring that instructions are performed sequentially

  • To: mathgroup at
  • Subject: [mg131465] ensuring that instructions are performed sequentially
  • From: Dushan Mitrovich <dushanm at>
  • Date: Mon, 29 Jul 2013 23:21:28 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

I'm trying to write my first, fairly short program in Mathematica  (version 9.0, 
under Mac OS X.6.8) and am encountering problems with instructions not 
being performed in sequence.  I'd appreciate help with straightening me 
out on what I'm doing wrong.

Here are two distilled snippets of the code, presented as two separate 
cells (indicated by the vertical bars on the left):

   | CreateDialog[Grid[{
   |     {"Initial date",
   |      InputField[Dynamic[id], String, FieldHint -> "## Month 20##"]},
   |     {"Forecast start date",
   |      InputField[Dynamic[fs], String, FieldHint -> "## Month 20##"]}
   |     }, Alignment -> Right], Modal -> True]

   | id = Take[ DateList[id], 3]
   | fs = Take[ DateList[fs], 3]

If I evaluate these cells one after the other I get the expected values 
for 'id' and 'fs'.

But if I merge them into one cell and evaluate it, the original 'id' and 
'fs' values show up even before the dialog window, and of course they 
are not updated with the new values.  How do I force sequential 
evaluation here?

The full program has six levels of nesting, so I put it all (100 lines) 
in one cell.  Eventually I'll make it into a CDF file, but meanwhile 
what is the right way to handle this sort of situation?


- Dushan Mitrovich

  • Prev by Date: Re: Variable transformations
  • Next by Date: Re: Incorrect (unexpected) output from TransformedField
  • Previous by thread: Re: Having difficulties improving Legend and plot
  • Next by thread: word documents