Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Can I use function keys as shortcuts?

    This may be a dumb question, but I spent some hours trying to put a function key (F1 to F12) + Ctrl as a shortcut to a button, without success.

    Is there anything wrong with the following code snippet?

    Code:
    	KeyIdentifier debugKey2 = new KeyIdentifier();        
            debugKey2.setCtrlKey(true);
            debugKey2.setKeyName("F2");
            
            Page.registerKey(debugKey2, new KeyCallback() {
    			
    			@Override
    			public void execute(String keyName) {
    				com.google.gwt.user.client.Window.alert("Ctrl F2");
    			}
    		});
    If I change "F2" to "A", the shortcut Ctrl+A starts working, but I'd like to use the F2 for compatibility reasons.

    I'm assuming the keyname for F2 key is F2, since com.smartgwt.client.types.KeyNames does not contain a constant for it.

    Can anyone point me to a direction?

    Thanks,
    Matheus
Working...
X