Test for dialog existence
- To: mathgroup at smc.vnet.net
- Subject: [mg112704] Test for dialog existence
- From: Chris Degnen <degnen at cwgsy.net>
- Date: Tue, 28 Sep 2010 06:01:47 -0400 (EDT)
Hi. Can anyone suggest how to test for the existence of a dialog?
In the example below a dialog is created containing a plot which can
be modified. However it seems to be difficult to test whether the
dialog has been closed.
This creates the dialog:
BeginPackage["TestExample`TestDialog`"];
CreateTestDialog::usage = "CreateTestDialog[] creates a test dialog";
Begin["`Private`"];
CreateTestDialog[] :=
Module[{}, n = 4;
CreateDialog[
plot = Dynamic[
ParametricPlot[{Sin[t], Sin[n t]}, {t, 0, 2 Pi}, Ticks -> None,
ImageSize -> 100]]]];
End[];
EndPackage[];
CreateTestDialog[];
And the plot can be modified by various means:
TestExample`TestDialog`Private`n = 8;
TestExample`TestDialog`Private`n = 2;
But how can I tell if the dialog has been closed? The dynamic plot
object still shows as existing afterwards:
NameQ["TestExample`TestDialog`Private`plot"]