Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 178
Registered: ‎11-19-2008
My Device: Not Specified
Accepted Solution

Legacy Keypad constant, what would be its equivalent?

Hi guys.

I'm upgrading a legacy project to a newer environment and compilation level. I'm totally puzzled with this line:

 

if (Keypad.key(keycode) == Keypad.getKeyCode('a', Keypad.STATUS_CHARACTER))

 The Keypad.STATUS_CHARACTER constant was compiling fine in the older 4.2 environment, but after porting it to the newer one it gives an error. That constant doesn't exist anymore. It does not even appear in the javadocs for 4.2 nor 4.0. That said, my questions are:

  • What could be the purpose of that line
  • If it were about handling the `a` key press, what would be the equivalent code in 4.5 or 5.0

Hope any of the old schoolers can give me a hint on this.

 

Thanks in advance.

 

 

Developer
Posts: 178
Registered: ‎11-19-2008
My Device: Not Specified

Re: Legacy Keypad constant, what would be its equivalent?

Well, given that there might not be many  "old schoolers" around in the forum (actually very few people left, since my last 3 questions were answered by myself), I'll post my findings:

 

  • The constant has a value of 3000h.
  • If it were a valid combination, Keypad.getKeyCode(char ch,int status) will return the same value (only the key part) for every valid status code, otherwise it will return 0.
  • The code aims to detect the pulsation of the 'a' key, without caring about status modifiers (like ALT, SHIFT, etc)
  • So I can safely replace the odd constant with 0.