You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old how to disable Right KeyPressed() button - 2009-06-30, 08:29

Join Date: May 2009
Posts: 108
elaltaico
Offline
Regular Contributor
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);
Reply With Quote

#2 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 08:44

Join Date: Jul 2008
Posts: 329
Location: Faridabad(Delhi NCR)
Send a message via MSN to ansh.chauhan Send a message via Yahoo to ansh.chauhan
ansh.chauhan's Avatar
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
Reply With Quote

#3 Old Thumbs up Re: how to disable Right KeyPressed() button - 2009-06-30, 08:55

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
raj_J2ME
Offline
Forum Nokia Champion
Hi,
Quote:
if(game == Display.GAME_RIGHT) {
//What I need to write here to disable right key?
}
Well,keypressed(int key) return the keycode of the particular key which was just pressed...correct.I wonder if you mean by "disable the right key that you do not want to anything when user presses the right key.If you want to so that then do not right any thing in that conditoin and as a result nothing will happen when user presses the right key,since there is no code segment inside.
I hope that this make some sense.


Thanks

R a j - The K e r n e l
Reply With Quote

#4 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 09:23

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
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....
Reply With Quote

#5 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 09:35

Join Date: May 2009
Posts: 108
elaltaico
Offline
Regular Contributor
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
Reply With Quote

#6 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 10:07

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
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 ?
Reply With Quote

#7 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 10:49

Join Date: May 2009
Posts: 108
elaltaico
Offline
Regular Contributor
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
Reply With Quote

#8 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 10:53

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
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 ?
Reply With Quote

#9 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 10:54

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
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
Reply With Quote

#10 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:14

Join Date: May 2009
Posts: 108
elaltaico
Offline
Regular Contributor
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
Reply With Quote

#11 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:27

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
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 ?
Reply With Quote

#12 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:39

Join Date: May 2009
Posts: 108
elaltaico
Offline
Regular Contributor
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
Reply With Quote

#13 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:46

Join Date: Apr 2007
Posts: 1,757
Tiger79's Avatar
Tiger79
Offline
Forum Nokia Champion
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 ?
Reply With Quote

#14 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:49

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
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
Reply With Quote

#15 Old Re: how to disable Right KeyPressed() button - 2009-06-30, 11:54

Join Date: Apr 2008
Posts: 10
gurusekhar
Offline
Registered User
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.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia