# Blocking dialog with a blocking child dialog

Suppose I have a DialogInput, in which there is a Button. The Button can trigger another DialogInput. Then, according to documentation, I have to add Method->"Queued" to the Button to avoid time out.

However, blocking dialog such as DialogInput blocks queued evalutaion channel, which makes the Button disabled.

The following cases are for demonstration.

1. DialogInput[Button["You have to wait after click", DialogInput[DialogReturn[1]]]] This works but you need to wait for minutes before the dialog prompts up.

2. DialogInput[Button["Doesn't work", DialogInput[DialogReturn[1]], Method->"Queued"]] This does not work because the outer DialogInput blocks the queued evalutaion channel.

Now, if I want a DialogInput with a Button and the Button should trigger another DialogInput, what should I do?

• It seems that you can't nest Kernel blocking dialogs. Maybe you could briefly describe the context so that we can find a work around? – Kuba Apr 1 '16 at 18:14
• @Kuba I am working on a questioning game. It's a Do loop. In each round a InputDialog shows with an InputField. When submitted, another ChoiceDialog prompts to ask the user to confirm the answer. In the ChoiceDialog, there is a button which can trigger an InputDialog for the user to change the answer. – Louis Yu Apr 3 '16 at 6:52
• Try nesting CreateDialog inside DialogInput – Algohi Apr 5 '16 at 21:06
• @Algohi Could you provide an example? Louis, is my answer of any help for you? – Kuba Apr 6 '16 at 13:50
• @Kuba, I did not post an answer because I don't have a complete answer to this question. I am myself facing same problem for long time ago and I am still living with that problem. what I am doing in my case is something like this (next comment) however if you run this code you will see that if you get value of y and press OK then the kernel is released before the main dialog box is closed. I would like to know your suggestion for this. Thanks – Algohi Apr 6 '16 at 14:43

I think there is no general/stable way to prompt kernel blocking dialog from another kernel blocking dialog.

answerPrompt[] := Input["Give me the answer please."];
confirmationPrompt[] := ChoiceDialog["Are you sure?"];


You don't need to do that though. Use the code below in your Do loop to answer and confirm questions:

While[
Not @ TrueQ @ confirmationPrompt[]
]


• Sorry for the late reply. But your code cannot be used in my case. Because there are some other taskes being processed in ChoiceDialog, it can not be released that early. – Louis Yu Apr 6 '16 at 15:38
• To be specific, what I am doing is a English word memorizing helper. In the input dialog I enter the meaning and then I compare it with the answer in the ChoiceDialog. The choice can be right or wrong or partial. My choice will be sent to a machine learning subroutine to analyze for future prediction. In the ChoiceDialog there are translations getting from some online dictionary API. However, that translations mat be wrong or redundant, so I may want to edit it. – Louis Yu Apr 6 '16 at 15:39
• Actually I can edit it in my database but it would be much more convenient if I can edit in that ChoiceDialog, since I will not have to reload those data and continue to answer questions in the next loop. – Louis Yu Apr 6 '16 at 15:40