×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2011
    Location
    The Heart of India
    Posts
    41

    Thumbs up Need euqivalent method of pointerPressed(int x,int y) for Nokia series 40 5th edition

    I am trying to develop cursor in my midlet application. i have already add cursor using drawImage() method. now i want to move it using navigation keys up down left and right... I developed this code:

    void keyPressed(int keyCode){
    int key=keyCode;
    switch(key){
    case -1: // to move up the cursor
    cursorY--;
    repaint();
    break;
    case -2: // to move down the cursor
    cursorY++;
    repaint();
    break;
    case -1: // to move left the cursor
    cursorX--;
    repaint();
    break;
    case -1: // to move right the cursor
    cursorX++;
    repaint();
    break;
    default:
    repaint();
    break;
    }
    this code is working properly but the only one problem is that to move the cursor from top to bottom, i have to press down key so many times..... I need any dragging concept to move the cursor.... i mean once i keep pressed a key for some time, cursor moves continue. In the above program, to move cursor, one has to keep press and unpressed the key continue.

    The method pointerPressed(int x,int y) is unsupported by all series 40 devices, so how to develop our own same method using existing API.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Need euqivalent method of pointerPressed(int x,int y) for Nokia series 40 5th edi

    Don't start the different threads for the same point/issues, already you have started this thread.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Jan 2011
    Location
    The Heart of India
    Posts
    41

    Re: Need euqivalent method of pointerPressed(int x,int y) for Nokia series 40 5th edi

    ya, i know that... but i don't wanna disturb you.... i can you please help me......

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Need euqivalent method of pointerPressed(int x,int y) for Nokia series 40 5th edi

    this code is working properly but the only one problem is that to move the cursor from top to bottom, i have to press down key so many times..... I need any dragging concept to move the cursor.... i mean once i keep pressed a key for some time, cursor moves continue. In the above program, to move cursor, one has to keep press and unpressed the key continue.
    You can do it using - keyRepeated() and pointerPressed(int x,int y) is not needed for this.

    OR

    You can do this by starting a loop that keep's on repeating the Cursor movement i.e. (cursorY-- / cursorY++/cursorX++/cursorX--) & calling repaint() in in your keyPressed() method till keyRelease() is not called, by using a global boolean variable repeat.
    try

    Code:
     
    // declare a call level boolean variable repeat at the start of your class
    
    void keyPressed(int keyCode){
    int key=keyCode;
    repeat= true;
    do while(repeat){
    switch(key){
    case -1: // to move up the cursor 
    cursorY--;
    repaint();
    break;
    case -2: // to move down the cursor 
    cursorY++;
    repaint();
    break;
    case -1: // to move left the cursor 
    cursorX--;
    repaint();
    break;
    case -1: // to move right the cursor 
    cursorX++;
    repaint();
    break;
    default:
    repaint();
    break;
    }
    void keyReleased(int keyCode)
    {
     repeat = false;
    }
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  5. #5
    Registered User
    Join Date
    Jan 2011
    Location
    The Heart of India
    Posts
    41

    Re: Need euqivalent method of pointerPressed(int x,int y) for Nokia series 40 5th edi

    thank you amitabh..... thank you very much...

Similar Threads

  1. SDK for Series 40 5th Edition LE?
    By tqvisten in forum Mobile Java Tools & SDKs
    Replies: 6
    Last Post: 2009-06-25, 12:48
  2. Int и signed Int обмен данными между ними
    By Clever brain in forum Russian Developer Forum - Форум Российских разработчиков
    Replies: 2
    Last Post: 2009-05-11, 21:35
  3. series 40 5th Edition - Nokia Model 6500
    By sidsood in forum Mobile Java General
    Replies: 3
    Last Post: 2008-12-23, 16:54
  4. createImage(byte[],int,int) bug on Nokia 7650
    By bachin in forum Mobile Java General
    Replies: 3
    Last Post: 2005-09-16, 03:49
  5. 请教createImage(byte[] imageData, int imageOffset, int imageLength) 的问题
    By RongJia in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 5
    Last Post: 2005-03-27, 17:18

Posting Permissions

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