Could anyone tell me the key code for the select button in the middle of the toggle key on the 6230i please? Many thanks, Martin.
Could anyone tell me the key code for the select button in the middle of the toggle key on the 6230i please? Many thanks, Martin.
Thanks Amin, I've tried that and it didn't work. Any other suggestions would be welcome. Martin.
If you have a phone available (which I guess you do since you say you tried it), why can't you just make a small app that displays the key codes on screen:
Although I'm pretty sure it's -5.Code:class KeyCodeCanvas extends Canvas { int code; public void paint(Graphics g) { g.setColor(0); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(0xffffff); g.drawString("code=" + i,0,0,Graphics.TOP|Graphics.LEFT); } protected void keyPressed(int keycode) { code = keycode; } }
One thing to check for: if you are subclassing GameCanvas make sure you didn't pass true to the constructor of the superclass because that will suppress events for keys that map to game actions.
shmoove
Tried that too, got all the key codes for every key from 0 to 9 including the * # and answer phone button, but the select button didn't output anything.
I assume that when the select button is pressed the keyPressed method is not called therefore the key code is not given.
Agreed that -5 is normally the key code for the fire button, but on the 6230i it doesn't work. Good point about the canvases but I've covered that off too.
Last edited by martin-in-bath; 2006-02-20 at 22:09.
Are you sure you didn't pass true to the suppressKeyEvents parameter of the GameCanvas contructor. That's the only reason I can think for the select button not to generate any keyPressed() calls.
AFAIK the only key that never generates any events in any case is the end key.Code:class MyGameCanvas extends GameCanvas { public MyGameCanvas() { super(false); // <-- make sure you are not passing true.
shmoove
I'm not using a game canvas, I'm just using a canvas. I do get key codes though from all the other keys.
Thanks for the info though. I'll keep digging...
Martin.
try to put your canvas in fullscreen mode ...
Hi,
you can print out the keycode in the keypressed method.
Regards
soku
Hi,
Are u tried the both the ways.
1.Directly checking the key code.
if(keCode==-5){
}
2.Getting the gameAction for the keyCode and processing it.
int action=getGameAction(keyCode);
if(action==Canvas.FIRE){
}
Try the both the ways....
- kamal
Thanks for these ideas, they are very good.
I'm using a MIDP1.0 canvas, I'll use a gameCanvas and let you know.
Hi,
Martin-in-bath and Quey, did you find any solution to this issue?
This is something I found out,
1. If absolutely No Command is added, then the LSK, MSK and RSK will call keyPressed() correctly
2. If even a Single Command is added then the MSK will not call keyPressed()
Regards,
abhayan