×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    9

    The strange pause between pointerPressed and pointerDragged

    Nokia developers, answer please, why you have implemented the pause between pointerPressed and pointerDragged method call?
    May I avoid it?

    My painting program shows delay between "head" of drawing a line and "body" of the line. First point of the line is shown -> pause 30-50ms -> then line appears smoothly as expected.

    Symbian application dispatch pointer pressed and pointer dragged events absolutely well.

    Help please. Anyone. Thank you.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: The strange pause between pointerPressed and pointerDragged

    On which device? I don't see a delay on my 5800XM. Then, 30-50ms...? That's pretty short.

    Graham.

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    9

    Re: The strange pause between pointerPressed and pointerDragged

    For a drawing program it is important. How did you test the issue?

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    9

    Re: The strange pause between pointerPressed and pointerDragged

    Exactly on Nokia 5800XM.
    I guess such a behaviour is a bug because Symbian dispatch pointer events well.
    Without any delays.
    I guess Java Machine dispatched pointer events well before installing the latest firmware update (ver 40 few days ago). But I am not sure. It is just suggestion.
    Last edited by ivanavdeyev; 2010-02-09 at 21:03. Reason: Errors.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    9

    Re: The strange pause between pointerPressed and pointerDragged

    package com.ivanavdeyev.test;

    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;

    public class TouchScreenTestMIDlet extends MIDlet {

    public void destroyApp(boolean flag) throws MIDletStateChangeException {
    }

    public void pauseApp() {
    }

    public void startApp() throws MIDletStateChangeException {
    Display.getDisplay(this).setCurrent(new Canvas() {

    private Image buffer;

    public void paint(Graphics g) {
    if (buffer != null) {
    g.drawImage(buffer, 0, 0, 0);
    }
    }

    public void pointerPressed(int px, int py) {
    drawPixel(px, py);
    }

    public void pointerDragged(int px, int py) {
    drawPixel(px, py);
    }

    public void sizeChanged(int width, int height) {
    buffer = Image.createImage(width, height);
    Graphics g = buffer.getGraphics();
    g.setColor(0x808080);
    g.fillRect(0, 0, buffer.getWidth(), buffer.getHeight());
    }

    public void drawPixel(int px, int py) {
    if (buffer != null) {
    Graphics g = buffer.getGraphics();
    g.setColor(0xffffff);
    g.fillRect(px, py, 1, 1);
    }
    repaint();
    }
    });
    }
    }

    When you start to draw a line you see that the distance between the first point and the second point bigger than between all the next points.
    It happens because first point is drawn with coordinates which were set in pointerPressed() method and all the next points receive their values from pointerDragged() method (which works well).

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: The strange pause between pointerPressed and pointerDragged

    I just had a quick look, using the existing touch-screen test app I already have. There didn't appear to be any delay, though I hadn't read that the delay is so short, and perhaps I wouldn't have noticed 50ms. If I get a chance, I'll do a more precise test tomorrow.

    I doubt you can do anything about it.

    Does this always happen? Or just the first time? I'm wondering if there's a JIT compiler lag on the first execution of pointerDragged()...?

    Graham.

  7. #7
    Registered User
    Join Date
    Sep 2009
    Posts
    12

    Re: The strange pause between pointerPressed and pointerDragged

    BTW, did you try to add Nokia-MIDlet-Tap-Detection-Options:0,0 to JAD file?
    I've noticed the same behaviour on 5530, and this solved my problem.
    And I guess that with new firmware for 5800 this option is available as well.

Posting Permissions

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