Is there a way to set the numlock on BlackBerry programmatically?
Is there a way to switch on and switch off the num lock (alt + aA) keys programmatically in BlackBerry. There is a method set开发者_Python百科Mode() in KeyPad class would that help?
Keypad.setMode(mode) - internal method for keyboard mode indicator update (ex 0 - none, 1 - numeric, 2 - alphabets).
You can use something like
class NLEditField extends EditField {
boolean mNumlockOn = false;
protected boolean keyChar(char key, int status, int time) {
if (mNumlockOn)
key = Keypad.getAltedChar(key);
return super.keyChar(key, status, time);
}
}
By using the net.rim.device.api.ui.component.BasicEditField, or subclasses, or any widget that allows you to set a net.rim.device.api.ui.text.TextFilter you can specify complex input semantics that will interpret the key presses in context of the type of input you desire: INTEGER, NUMERIC, UPPERCASE, EMAIL, URL, etc.
精彩评论