Login  Register

Re: subtle interaction request

Posted by John Hayes on Feb 05, 2019; 5:02am
URL: http://imagej.273.s1.nabble.com/subtle-interaction-request-tp5021743p5021744.html

Dear Kenneth,

Since no one has responded I thought I’d send my 2cents. I’m not sitting in front of the code-base right now, but I believe you can get a reference to the Dialog through the ij.WindowManager class to the Java AWT (java.awt.Window) window by name using WindowManager::getWindow, or WindowManager::getCurrentWindow might work, or WindowManager::getActiveWindow or something similar since Dialogs are Java AWT Windows: https://docs.oracle.com/javase/7/docs/api/java/awt/Dialog.html
and indeed IJ GenericDialogs are as well:
https://imagej.nih.gov/ij/developer/api/ij/gui/GenericDialog.html

Then you should be able to change the focus of the cursor to whatever you want (and certainly not the CANCEL button) I would think. You may need to remove/add ActionListeners to the respective components you are interested in to accommodate your needs though.

I’ll try to play with the actual code tomorrow (eastern American time) if you haven’t come up with a solution by then… please let us know if you or others have solved your needs in the meantime...

All the best,
John

> On Feb 4, 2019, at 5:07 PM, Kenneth Sloan <[hidden email]> wrote:
>
> In a Java plugin:
>
> I have an image open...
>
> I want to display a NonBlockingGenericDialog (or, something else that will have the same effect)
>
> BUT...I want the image window to be selected - without user interaction.
>
> The problem is that I want to use the SPACE bar to toggle an overlay on/off - but if the user gets sloppy and
> hits the SPACE bar while the dialog window is still on top...it is CANCELed.  Once I display the dialog box,
> my program can't do anything.  Catch-22.
>
> Perhaps I simply need to prevent SPACE from invoking the standard action of CANCEL?
>
> Going off to read the documentation, again.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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