我正在尝试检测并覆盖黑莓键盘上的 Delete 键。
出于某种原因,它从来没有在我的案例陈述中出现,因为它达到了这一点:
Keypad.key(keycode) == 8
Keypad.KEY_DELETE == 127
我的错误是什么?
public class MyField extends ListField implements KeyListener {
// ...
/** Implementation of KeyListener.keyDown */
public boolean keyDown(int keycode, int time) {
boolean retval = false;
switch (Keypad.key(keycode)) {
/* DELETE - Delete the timer */
case Keypad.KEY_DELETE:
if (Keypad.status(keycode) == KeyListener.STATUS_SHIFT) {
_myDeleteCmd.run();
retval = true;
}
break;
default:
retval = super.keyDown(keycode, time);
}
return retval;
}