Login  Register

Antwort: Intercepting keystrokes in plugin

Posted by Joachim Wesner on Jul 22, 2009; 9:36am
URL: http://imagej.273.s1.nabble.com/Intercepting-keystrokes-in-plugin-tp3691678p3691681.html

Hi Jeff,

you mean, your plugin kets the keys as it should be, but it will ALSO be
handled by ImageJ?

I´m not sure, which happens first, just did a quick internet search, there
is a

KeyEvent.consume

methods, which marks an event as already fully handled, you might give it a
try!?

Mit freundlichen Grüßen / Best regards

Joachim Wesner
Projektleiter Optik Technologiesysteme


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



                                                                           
             Jeff Hardin                                                  
             <[hidden email]                                            
             U>                                                         An
             Gesendet von:              [hidden email]                
             ImageJ Interest                                         Kopie
             Group                                                        
             <[hidden email].                                       Thema
             GOV>                       Intercepting keystrokes in plugin  
                                                                           
                                                                           
             22.07.2009 07:39                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




Hello Imagers,

I wrote a plugin a long time ago (for browsing 4d datasets from disc)
that extends the ImageWindow class, and creates a KeyListener to act
on the up, down, left, and right arrow keys. This worked well before
the default behavior was to magnify or reduce the ImageWindow using
the right and left arrow keys, as in more recent versions of ImageJ.
Now the plugin reads the key stroke and acts on it, but the key stroke
is passed to ImageJ, which then magnifies or reduces the ImageWindow.
I guess I'm stupid, but I don't see how to prevent this.

Any ideas would be deeply appreciated!

Cheers,

Jeff
----------------------------------------------
Jeff Hardin
Professor and Chair, Department of Zoology
Director, Biology Core Curriculum
University of Wisconsin
1117 W. Johnson St.
Madison, WI 53706
voice: (608) 262-9634
fax: (608) 262-7319
email: [hidden email]
web page: http://worms.zoology.wisc.edu



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