diff --git a/src/controlP5/ControlWindow.java b/src/controlP5/ControlWindow.java index 5548315..bf0462e 100755 --- a/src/controlP5/ControlWindow.java +++ b/src/controlP5/ControlWindow.java @@ -463,6 +463,13 @@ public final class ControlWindow { return; } + if ( theKeyEvent.getAction( ) == KeyEvent.TYPE ) { + keys[ theKeyEvent.getKeyCode( ) ] = true; + numOfActiveKeys++; + cp5.modifiers = theKeyEvent.getModifiers( ); + key = theKeyEvent.getKey( ); + } + if ( theKeyEvent.getAction( ) == KeyEvent.PRESS ) { keys[ theKeyEvent.getKeyCode( ) ] = true; numOfActiveKeys++; @@ -475,6 +482,7 @@ public final class ControlWindow { keys[ theKeyEvent.getKeyCode( ) ] = false; numOfActiveKeys--; cp5.modifiers = theKeyEvent.getModifiers( ); + keyCode = theKeyEvent.getKeyCode( ); } if ( theKeyEvent.getAction( ) == KeyEvent.PRESS && cp5.isShortcuts( ) ) { diff --git a/src/controlP5/Textfield.java b/src/controlP5/Textfield.java index b42957c..8588614 100755 --- a/src/controlP5/Textfield.java +++ b/src/controlP5/Textfield.java @@ -357,15 +357,25 @@ public class Textfield extends Controller< Textfield > { } public void keyEvent( KeyEvent theKeyEvent ) { - if ( isUserInteraction && isTexfieldActive && isActive && theKeyEvent.getAction( ) == KeyEvent.PRESS ) { - if ( ignorelist.contains( cp5.getKeyCode( ) ) ) { - return; - } - if ( keyMapping.containsKey( cp5.getKeyCode( ) ) ) { - keyMapping.get( cp5.getKeyCode( ) ).execute( ); - } else { + if ( isUserInteraction && isTexfieldActive && isActive) { + if(theKeyEvent.getAction( ) == KeyEvent.TYPE) { + if ( ignorelist.contains( cp5.getKeyCode( ) ) ) { + return; + } + if ( keyMapping.containsKey( cp5.getKeyCode( ) ) ) { + return; + } keyMapping.get( DEFAULT ).execute( ); } + + if( theKeyEvent.getAction( ) == KeyEvent.PRESS ) { + if ( ignorelist.contains( cp5.getKeyCode( ) ) ) { + return; + } + if ( keyMapping.containsKey( cp5.getKeyCode( ) ) ) { + keyMapping.get( cp5.getKeyCode( ) ).execute( ); + } + } } } @@ -473,4 +483,4 @@ public class Textfield extends Controller< Textfield > { } } -} \ No newline at end of file +}