Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15262

ensuring that instructions are performed sequentially

From Dushan Mitrovich <dushanm@nnips.net>
Newsgroups comp.soft-sys.math.mathematica
Subject ensuring that instructions are performed sequentially
Date 2013-07-30 03:18 +0000
Message-ID <kt7bad$dkh$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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?

Thanks.

- Dushan Mitrovich

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

ensuring that instructions are performed sequentially Dushan Mitrovich <dushanm@nnips.net> - 2013-07-30 03:18 +0000

csiph-web