| Reply | « Previous Thread | Next Thread » |
|
Hello
I am using J2ME LWUIT to design my application. I have some buttons at my page. When I press right button key, it also goes to next button . What I need to do to disable keyPressed() buttons? Here is my keyPressed() button : Button button2=new Button("Doktorların Alfabetik Listesini Görme için Tıklayınız."){ public void keyPressed(int key) { int game=Display.getInstance().getGameAction(key); if(game == Display.GAME_LEFT) { getForm1A(); } if(game == Display.GAME_FIRE) { getForm2B(); } if(game == Display.GAME_RIGHT) { //What I need to write here to disable right key? } } }; SixthPanel.addComponent(button2); |
|
Join Date: Jul 2008
Posts: 329
Location: Faridabad(Delhi NCR)
ansh.chauhan
Offline
Regular Contributor
|
|
can please explain completely what exactly you want to do.If you want to disable right key then don't write it in key pressed that's it.If you want something else then please explain us
Anshu Chauhan J2me Developer |
| ansh.chauhan |
| View Public Profile |
| Find all posts by ansh.chauhan |
|
Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
raj_J2ME
Offline
Forum Nokia Champion
|
|
|
Hi,
Quote:
I hope that this make some sense. Thanks R a j - The K e r n e l |
|
code seems good to me just like that, you don't do anything in response to the Display.GAME_RIGHT code...
the only other thing might be that if still something does happen it most probably is an implementation of LWUIT itself.... |
|
Hello
Unfortunately I tried as what you told me before. I tried to write if(game == Display.GAME_RIGHT) { //When user clicked at me,nothing should happen } ...but it did not work.When I clicked right button it goes to next button which should not be. When I click down button it can go to next button without any problem as I wanted. But "right key" does same job as "down key". I think this comes with LWUIT.I did not get any reply from LWUIT guys as well. That's why I wanted to ask it here. Do you know anything which disable right key ? Regards Altayli |
|
ok first of all lets make sure you actually DO catch the key getting pressed :
so please write some text to the output (or an ALert) when the key gets pressed, just to be sure that it all works as you expect it to work : if(game == Display.GAME_RIGHT) { System.out.print("Just pressed the RIGHT KEY"); } and do the same for the DOWN KEY... Then start pressing those and see what happens... Btw are you testing on emulator or ondevice ? |
|
I am trying it on emulator. .System.out.print("Just pressed the RIGHT KEY"); can be seen when I clicked RIGHT KEY and ("Just pressed the DOWN KEY"); can be seen when I clicked DOWN Key.But it still goes on going next key when I clicked RIGHT KEY.
Regards Altayli |
|
hhmmm.. that's pretty strange...
what if you place something like : Display.getDisplay.setCurrent(this); in that code ? So that when te right button is pressed you simply ask to show the same screen your in at the moment ? |
|
Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
raj_J2ME
Offline
Forum Nokia Champion
|
|
Hi,
What do you mean by Next Key? Thanks R a j - The K e r n e l |
|
Hello
Sorry Tiger Display.getDisplay.setCurrent(this); does not work :(. raj_J2MEkey I meant when I click "right key" it goes to "NEXT" BUTTON. For instance, when I was at button 1 and when I click "right key" it goes to Button2 which should not happen. Apologizes for disturing but I need to fix this issue. Thank you so much Regards Altayli |
|
ok what is LWUIT's code to display a particular Displayable ?
how do you display the screen you are on at the moment (the one that gets replaced by the "next one") ? And can you place that code in the RIGHT_KEY handling method ? |
|
Display.init(this);
Form a1=new Form(); a1.show(); To display a screen I use this one : getForm1A(); then it will go to getForm1A() and by the help pf the a1.show it displays Form 1. When I pasted Display.getDisplay.setCurrent(this); I come across with this error: cannot find symbol symbol:variable getDisplay and cannot find symbol symbol:method setCurrent(<anonymous com.sun.Lwuit.Button). I modified Display.getDisplay.setCurrent(this) but still it does not work. I called getForm1A() instead of it. (i called form's itself, I think it does same job with the code that you provided). For instance,when I was at button 8 and when I do that,then I will go to button1 it means at the beginning of the form or everything happens from beginning. I guess that would not be professional.Apologizes for disturbing again Regards Altayli |
|
well yes the idea would be that it should call itself instead of another Form (the "next" you are talking about???)...
even though if I hear your explanation it sounds like you have some kind of list and according to the pressed button you go up and down the list or something like that ? "For instance,when I was at button 8 and when I do that,then I will go to button1 it means at the beginning of the form or everything happens from beginning" actually I am lost at the moment, I don't exactly undertand your situation, and/or what your trying to do exactly... anyways it looks to me LWUIT has its own implementation (maybe of the Form) regarding the pressing of buttons... maybe its even set up as a soft button ? |
|
Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
raj_J2ME
Offline
Forum Nokia Champion
|
|
Hi,
Well,in order to get the quick and accurate reply you are supposed to give the answer those has been ask so far.Anyways,how you have implement the increment of the button index.I will recommend you that please share the logic for the same,how you are increasing the counter or so,when you are pressing the keys,on which you want to increase the button, Thanks R a j - The K e r n e l |
|
HI elaltaico,
Instead of writing anything just "return" from there if your keypressed() method was called first. If LWUIT package is handling any keypressed events then it should be changed from there. |
| gurusekhar |
| View Public Profile |
| Find all posts by gurusekhar |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| How to disable CANCEL button of CAknGlobalNote | pranay_preet | General Symbian C++ | 3 | 2008-11-06 10:23 |
| How to Disable Menubar or Cba button in AknView..? | bunnyheidi | Symbian User Interface | 2 | 2006-03-10 05:45 |
| Disable "Hang-Up" button and textfield color ? | Dark16 | Mobile Java General | 2 | 2003-05-06 10:04 |
| Disable "Hang-Up" button and textfield color ? | Dark16 | Mobile Java Media (Graphics & Sounds) | 1 | 2003-05-06 09:27 |
| How can I disable the # button and the T9 | Beri | General Symbian C++ | 2 | 2002-11-11 01:41 |