Dear Philippe,

Here is a non-modal dialog with customizable “Yes” and “No” buttons:

 Dialog.createNonBlocking("YesNoCancel Demo");
 Dialog.addMessage("Non-blocking YesNoCancel dialog");
 Dialog.enableYesNoCancel("Yes", "No");
 Dialog.show;
 print("User clicked \""+Dialog.getYesNoCancel+"\"”);

The macro is aborted if the user clicks on “Cancel”.

It requires ImageJ 1.54h, which adds Dialog.enableYesNoCancel(yesLabel,noLabel) 
and Dialog.getYesNoCancel macro functions.

And here is a JavaScript version:

 gd = new NonBlockingGenericDialog("YesNoCancel Demo");
 gd.addMessage("This is a YesNoCancel dialog");
 gd.enableYesNoCancel("Do something", "Do something else");
 gd.showDialog();
 if (gd.wasCanceled())
    IJ.log("User clicked 'Cancel'");
 else if (gd.wasOKed())
    IJ. log("User clicked 'Yes'");
 else
    IJ. log("User clicked 'No'”);

-wayne

> On Dec 13, 2023, at 5:42 PM, CARL Philippe (LBP) <[email protected]> 
> wrote:
> 
> Dear all (probably Wayne),
> I would like to have a non modal dialog box in macro langage for which I 
> could have the possibility to have custom "Yes", "No" and "Cancel" buttons.
> Within the dialog creation there is the possibility to have a non-modal 
> dialog box (through the use of Dialog.createNonBlocking) but with this method 
> there is no possibility to have some (either custom or not) "Yes", "No" and 
> "Cancel" buttons.
> In parallel there is the getBoolean method, but very unfortunately its dialog 
> box is modal.
> Thus would it please be possible to have a nonBlockingGetBoolean(message, 
> yesLabel, noLabel) method implemented ?
> Thanks a lot in advance.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to