views:

159

answers:

2

Is there a way to switch on and switch off the num lock (alt + aA) keys programmatically in BlackBerry. There is a method setMode() in KeyPad class would that help?

+2  A: 

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.

Richard
+2  A: 

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);
 }
}
Max Gontar