Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: ensuring that instructions are performed sequentially
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Dushan Mitrovich

Posts: 22
Registered: 5/7/11
ensuring that instructions are performed sequentially
Posted: Jul 29, 2013 11:18 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.