In my opinion, for most uses, the most effective and reliable way to track
the pen on the Palm (unlike Windows, and more like the original Mas OS) is
to poll the pen position modally in response to a penDown, until the pen
goes up, and ignore the penMove and penUp events.  You will "hang" the
device while the pen is down, but the alternative of trying to let other
events through while you are tracking causes all sorts of problems that are
very difficult to get right.  And if you think about it, the consequences of
delaying other events until the pen goes up is almost always a good thing
for the user anyway.  Thus, you want something like:

case penDownEvent:
    if (FrmGetWindowHandle(FrmGetActiveForm()) == WinGetActiveWindow())
        {
        EvtGetPen(&x, &y, &penDown);
        if (hit test at x, y)
            {
            while (penDown)
                {
                // process (x, y);
                EvtGetPen(&x, &y, &penDown);
                }
            handled = true;
            }
        }
    break;

Anybody disagree?

Dave Parker
TapPoint  www.tappoint.com



"Nick Amato" <[EMAIL PROTECTED]> wrote in message
news:99027@;palm-dev-forum...
>
> I've created a simple drawing program that stores the last position of the
> pen then draws a straight line to the current position.  The program works
> fine on the emulator but when I run it on my handspring I have a little
> grudge.  When I click on the application to run it, I click on the icon
and
> it loads my program and draws a line from the top corner to the position
> where I touched the icon.
>
> Is there anyway to remove events in the frmOpenEvent without screwing
> anything else up? Does someone have a different suggestion on how to
> sidestep this problem?
>
> Thanks
>
> Nick
>
>        case penDownEvent:
>         if(eventP->screenY <148) //make sure the drawing doesn't affect
the
> buttons on bottom
>         {
>             old_x = eventP->screenX; //old_x and y are the "previous"
> coordinates and are global
>             old_y = eventP->screenY; //to this form.
>             handled = true;
>         }
>            break;
>
>         case penUpEvent:
>        case penMoveEvent:
>    if(eventP->screenY <148)
>         {
>           setdot(eventP->screenX, eventP->screenY); //calls WinPaintLine
and
> changes the "old" values
>             handled = true;
>            }
>          break;
>
>
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to