Login  Register

Keyevent problem

Posted by Joachim Wesner on Jul 20, 2009; 11:28am
URL: http://imagej.273.s1.nabble.com/GenericDialog-programmatic-OK-tp3691723p3691728.html

Hi again,

I just noted some other inconvenience where I don´t see a simple solution:

I have a plugin that creates an image window with an ImageListener that
monitors the close event.

The idea behind it is that when the user closes the window, normally the
initial plugin dialog will reappear, so she/he can makesome changes to the
parameters and try again
without having to restart all over again.

However, if she/he keeps the Ctrl-key pressed while closing the window with
the mouse (I use IJ.controlKeyDown()), the plugin will terminate and not
show the dialog again.

This works flawlessly so far on it´s own, however, if the user uses
*certain* shortcuts involving the control key, the Imagelistener will still
see a
depressed control key even if it has already been released.

It seems this is due to the fact that the key-release event goes to a
different window and is lost for the initial window resp. IJ!?

I did some quick checks, the problem happens for ex. when one uses
control-P to print the window (where I noted it), it seem that the event is
lost to the "printer setup" window,
it only will work is control is released AFTER closing the print window.

I contrast, there is no problem with "Adjust" Control-Shift-C, even when
released early.

Any simple idea to fix this? From what I find in the net, this seems to be
not an easy issue in Java!

Probably for a quick solution, I will try changing to the Alt-key, which is
normally not active in IJ.


Mit freundlichen Grüßen / Best regards

Joachim Wesner
____________________________________________

Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________