MathGroup Archive 2008

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

Search the Archive

Strange behaviour of DialogInput and DialogCreate in 6.0.1

  • To: mathgroup at
  • Subject: [mg86845] Strange behaviour of DialogInput and DialogCreate in 6.0.1
  • From: Januk <ggroup at>
  • Date: Sun, 23 Mar 2008 01:02:20 -0500 (EST)


I am trying to use DialogInput to allow users of my notebook to set
parameters in a nice graphical way.  I'm running into a few problems
and was hoping someone might point me in the right direction.

The first problem is, if I set a variable using the result of
DialogInput, I can't use that variable in subsequent commands in that
cell.  Below is a simple example (put contents in a single cell):

   test = 5
   test = DialogInput[{"Some Result",

Out[1]= 5
Out[1]= 10
Out[5]= test

I'm not sure I understand what's going on here.  The final call of
test appears to have *no* value, not even the original value 5 that
was set.  Now if we create a second cell,


Out[2]= 10

So it appears the variable does get set at some point, just not at the
time I expect it to be set.

The second problem I'm running into is that if I use a Dynamic around
a global variable in a dialog, it will not update that variable when I
exit from the dialog.  In fact, one of the examples from the Help file
doesn't work as advertised for me:

In[1]:= CreateDialog[{TextCell["Enter a name: "],
  InputField[Dynamic[nm], String],
  DefaultButton[DialogReturn[ret = nm]]}];

In[1]:= ret
Out[1]= ret

Note that the history index is not incremented after the CreateDialog

The third problem I have would probably be solved if I can get
workarounds to the first two.  That is, I want to make the dialog from
DialogInput modal.  I don't see how to do that.  I would use
CreateDialog or DialogNotebook, but as I mentioned, I don't appear to
have any working mechanism to return values.

Any suggestions of what I might be doing wrong or workarounds would be
much appreciated.


  • Prev by Date: Mathlink: How do I pass arbitrary data from Mathematica to C?
  • Next by Date: SoundNote: velocity?
  • Previous by thread: Re: Mathlink: How do I pass arbitrary data from Mathematica to C?
  • Next by thread: SoundNote: velocity?