Re: Non-modal dialog with Yes No Cancel
Posted by
Michael Schmid on
Oct 13, 2020; 8:09am
URL: http://imagej.273.s1.nabble.com/Non-modal-dialog-with-Yes-No-Cancel-tp5024006p5024035.html
On 12.10.20 21:56, Kenneth Sloan wrote:
> Just a side note: why does a macro abort when gd.wasCanceled() is called? If Cancel is supposed to abort the macro, why wait until the macro asks the question? Does this mean that "Cancel" does NOTHING if the script doesn't ask the question?
Hi Kenneth,
hmm, I guess that the idea is that user plugins that don't care about
gd.wasCanceled() should also not get the macro interrupted if the user
presses <cancel>.
I fear, however, that plugins that allow the user to press <cancel>, but
to not terminate in that case, will use gd.wasCanceled() anyhow, to
determine whether they should process the dialog input or not.
If you use a dialog in a *macro*, Dialog.show() will check for
gd.wasCanceled(). E.g in the following macro
Dialog.create("test dialog");
Dialog.show();
print("dialog done");
you won't get the 'dialog done' output if the user has pressed <cancel>.
Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html