# Why doesn't the FileNameSetter button work in my DialogInput?

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"],
DefaultButton[DialogReturn[x]]}]


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

-

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:"],
InputField[Dynamic[x]],
FileNameSetter[Dynamic[x], "Directory", Method -> "Preemptive"],
DefaultButton[DialogReturn[x]]}]

-

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"],
DefaultButton[]}]

-
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