Login  Register

Re: Wait for user / NonBlockingGenericDialog

Posted by Michael Schmid on Oct 30, 2013; 8:47am
URL: http://imagej.273.s1.nabble.com/Wait-for-user-NonBlockingGenericDialog-tp5005270p5005380.html

Hi Steven,

here is an example for how to use the WaitForUser Dialog.
It works well in my case; the "dialog finished" message appears after I click OK.

import ij.IJ;
import ij.plugin.PlugIn;
import ij.gui.*;

public class WaitForUserTest implements PlugIn {

    public void run(String arg) {
        IJ.setTool("point");
        WaitForUserDialog wfd = new WaitForUserDialog("Test",
                "Select the point and press OK when done");
        wfd.show();
        IJ.log("dialog finished");
    }
}

As I said, it won't work in the message queue, so you must not call the WaitForUserDialog from any of the MouseListener, KeyListener, DialogListener etc, callbacks such as keyPressed, mouseDragged, dialogItemChanged, ...

Michael
________________________________________________________________
On Oct 25, 2013, at 16:46, Influenza wrote:

> Hi Michael!
>
> Thanks for your respond, but I of course added the x.show(); Method in my
> Plugin I just forgot to post it within my example code. The problem stays
> the same!

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