Take the 2-minute tour ×
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

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.