Typing characters with accent marks in a textbox #38

This commit is contained in:
João Lopes 2019-01-25 17:28:25 +00:00
parent d3dad67633
commit e4d5e0160a
2 changed files with 26 additions and 8 deletions

View File

@ -463,6 +463,13 @@ public final class ControlWindow {
return; return;
} }
if ( theKeyEvent.getAction( ) == KeyEvent.TYPE ) {
keys[ theKeyEvent.getKeyCode( ) ] = true;
numOfActiveKeys++;
cp5.modifiers = theKeyEvent.getModifiers( );
key = theKeyEvent.getKey( );
}
if ( theKeyEvent.getAction( ) == KeyEvent.PRESS ) { if ( theKeyEvent.getAction( ) == KeyEvent.PRESS ) {
keys[ theKeyEvent.getKeyCode( ) ] = true; keys[ theKeyEvent.getKeyCode( ) ] = true;
numOfActiveKeys++; numOfActiveKeys++;
@ -475,6 +482,7 @@ public final class ControlWindow {
keys[ theKeyEvent.getKeyCode( ) ] = false; keys[ theKeyEvent.getKeyCode( ) ] = false;
numOfActiveKeys--; numOfActiveKeys--;
cp5.modifiers = theKeyEvent.getModifiers( ); cp5.modifiers = theKeyEvent.getModifiers( );
keyCode = theKeyEvent.getKeyCode( );
} }
if ( theKeyEvent.getAction( ) == KeyEvent.PRESS && cp5.isShortcuts( ) ) { if ( theKeyEvent.getAction( ) == KeyEvent.PRESS && cp5.isShortcuts( ) ) {

View File

@ -357,15 +357,25 @@ public class Textfield extends Controller< Textfield > {
} }
public void keyEvent( KeyEvent theKeyEvent ) { public void keyEvent( KeyEvent theKeyEvent ) {
if ( isUserInteraction && isTexfieldActive && isActive && theKeyEvent.getAction( ) == KeyEvent.PRESS ) { if ( isUserInteraction && isTexfieldActive && isActive) {
if ( ignorelist.contains( cp5.getKeyCode( ) ) ) { if(theKeyEvent.getAction( ) == KeyEvent.TYPE) {
return; if ( ignorelist.contains( cp5.getKeyCode( ) ) ) {
} return;
if ( keyMapping.containsKey( cp5.getKeyCode( ) ) ) { }
keyMapping.get( cp5.getKeyCode( ) ).execute( ); if ( keyMapping.containsKey( cp5.getKeyCode( ) ) ) {
} else { return;
}
keyMapping.get( DEFAULT ).execute( ); 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 > {
} }
} }
} }