×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    2

    Exclamation navigation key in s40

    i write a given code for using navigation key but in s40 devices instead of navigation key 2,5,8 key produce the respected event

    protected void keyPressed(int key) {
    if (getKeyCode(DOWN) == key) {

    x = x + 1;
    if (x >= 3) {
    x = 3;
    }


    repaint();
    }

    if (getKeyCode(UP) == key) {

    x = x - 1;
    if (x <= 0) {
    x = 0;
    }

    repaint();
    }
    if (getKeyCode(FIRE) == key) {
    if (x == 0) {
    as.display.setCurrent(as.form);
    }
    if (x == 1) {
    as.display.setCurrent(as.formm1);
    }
    if (x == 3) {
    as.destroyApp(true);
    as.notifyDestroyed();
    }
    }
    }

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: navigation key in s40

    Hello harshkurra21,

    based on the MIDP specification:

    "...the class Canvas has methods for handling abstract game events. An implementation maps all
    these key events to suitable keys on the device. For example, a device with four-way navigation and a select
    key in the middle could use those keys, but a simpler device may use certain keys on the numeric keypad (e.g.,
    2, 4, 5, 6, 8).
    So based on your findings it seems that the numeric keypad is used in the Series 40 devices accordingly the definition of the specification. I presume this is due to backward compatibility purposes mainly, need to check this further to ensure.

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    2

    Re: navigation key in s40

    now i change my code as shown below ,but still centre navigation key ( fire key ) not working on s40(nokia classic 2730) .moreover send key (call pick up ) work in place of it .please help me and give me the code to use the centre button

    protected void keyPressed(int key) {
    int game=getGameAction(key);
    if (game== DOWN)
    {

    x = x + 1;
    if (x >= 3) {
    x = 3;
    }


    repaint();
    }

    if (game== UP) {

    x = x - 1;
    if (x <= 0) {
    x = 0;
    }

    repaint();
    }
    if (game== FIRE) {
    if (x == 0) {
    as.display.setCurrent(as.form);
    }
    if (x == 1) {
    as.display.setCurrent(as.formm1);
    }
    if (x == 3) {
    as.destroyApp(true);
    as.notifyDestroyed();
    }
    }
    }

  4. #4
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: navigation key in s40

    Are you using full-screen mode or normal mode for your Canvas?

    If you are using the normal mode, please check whether using the full-screen mode helps:

    Canvas yourCanvas;

    ..

    yourCanvas.setFullScreenMode(true);


    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Similar Threads

  1. Tab navigation
    By patmarc in forum Symbian
    Replies: 9
    Last Post: 2009-09-04, 14:43
  2. Tab Navigation
    By Kavit Patel in forum Symbian
    Replies: 14
    Last Post: 2008-03-10, 13:03

Posting Permissions

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