Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am new to Mathematica, so it's probably a small error but I can't figure it out.

Here is the code :

DialogInput[{TextCell["Choose your folder:"], InputField[Dynamic[x]], 
  FileNameSetter[Dynamic[x], "Directory"], 

When I click on the browse button, nothing happen. Then, when I click on OK, the file system browsing window appears.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Another way to get around the fact that the kernel will block until DialogReturn is evaluated is to use Method -> "Preemptive":

DialogInput[{TextCell["Choose your folder:"],
  FileNameSetter[Dynamic[x], "Directory", Method -> "Preemptive"], 
share|improve this answer
It seem that now Automatic method know what to. – Kuba Feb 2 at 9:18
@Kuba It seems to work in V9, too, even though it gives an error message. No error message in V10. (No change indicated in the documentation, so they consider this a minor fix, I guess.) Odd that the default behavior is not the same as Automatic. – Michael E2 Feb 2 at 11:14
Yes, it seems you have to know what you want and always place it explicitly if you want things to work :) – Kuba Feb 2 at 11:16

Mathematica "freezes" until you press the dialog return. This is by design for DialogInput as far as I know. So instead use CreateDialog

CreateDialog[{TextCell["Choose your folder:"], InputField[Dynamic[x]],
   FileNameSetter[Dynamic[x], "Directory"], 
share|improve this answer
That's what I wanted to use. However, CreateDialog doesn't "freeze" and so the code go on without waiting for the input (I tried Modal->True but it didn't work in this case). – Stef Aug 13 '13 at 13:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.