Re: Problems with ChoiceDialog inside a Dynamic: Bug
- To: mathgroup at smc.vnet.net
- Subject: [mg107830] Re: Problems with ChoiceDialog inside a Dynamic: Bug
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Sun, 28 Feb 2010 04:51:39 -0500 (EST)
- References: <hm573n$kge$1@smc.vnet.net> <201002252237.RAA17081@smc.vnet.net> <399C2A8F-0FBD-4B52-B366-8E223A6517DF@gtripaldi.it> <hmak9b$bl9$1@smc.vnet.net>
Hi,
> Modality and blocking the kernel are two separate behaviors. Modal
> simply means that the user cannot access windows beneath the dialog
> while a blocking dialog holds the kernel evaluation until closed. So for
> example, the following dialog is modal and does not block:
That is true and now works as you have described in version 7. In
version 6 it did not work as described above, but probably was planned
to work this way. Good to know it now works...
> In[9]:= CreateDialog[
> Grid[{{"Does the earth has oceans?"}, {ChoiceButtons[{DialogReturn[
> answer = True], DialogReturn[answer = False]}]}}],
> Modal -> True];
>
> In[10]:= answer
>
> Out[10]= False
>
> As for the Dynamic[],
>
> DynamicModule[{planets, x, habitantq},
> planets = {"Mercury", "Venus", "Earth"};
> x = First[planets];
> PopupMenu[Dynamic[x, {x = #;
> If[StringMatchQ[x, "Earth"],
> habitantq =
> CreateDialog[
> Column[{"Do you live on earth?",
> Row[{DefaultButton[
> Print["This user has selected earth as their planet of \
> residence"]; DialogReturn[True]],
> CancelButton[DialogReturn[False]]}]}]]]} &,
> Evaluator -> Automatic, Method -> "Queued"], planets]]
>
> again, adding Modal->True if desired.
That is really helpful. I'm a little confused about the options you give
to Dynamic: Isn't Evaluator->Automatic the default anyway and have you
any evidence that Method->"Queued" given to a Dynamic will actually do
anything? It is mentioned neither in Options[Dynamic] nor in the
documentation. Also it seems to not the desired effect, since with a
kernel blocking ChoiceDialog instead of the CreateDialog Mathematica
still hangs....
regards,
albert
- References:
- Re: Problems with ChoiceDialog inside a Dynamic: Bug or not (well)
- From: Albert Retey <awnl@gmx-topmail.de>
- Re: Problems with ChoiceDialog inside a Dynamic: Bug or not (well)