I found that the program does not go into the below if statement in the
penDownEvent  case,
why and how can I correct this?

                     if (RctPtInRectangle(eventP->screenX,
                         eventP->screenY, &gDrawRect))

thx!!


"KEN" <[EMAIL PROTECTED]> �b�l�� news:[EMAIL PROTECTED] �����g...
> I want to write a simple doodling program just for the stylus to draw
> something
> I modified the  MainFormHandleEvent  of the simple Hello Palm and added
some
> global variables as shown below.
> But I found that it doesn't work and it shows nothing when I draw using
> stylus.
> Any problem with this program ?
>
>
> // Global variables
> RectangleType  gDrawRect;
> Int16                 gX, gY;
> Boolean            gPenDown;
>
> static Boolean MainFormHandleEvent(EventType * eventP)
> {
>          Boolean handled = false;
>          FormType * frmP;
>
>          switch (eventP->eType)
>          {
>               case menuEvent:
>                     return MainFormDoCommand(eventP->data.menu.itemID);
>
>             case frmOpenEvent:
>                     frmP = FrmGetActiveForm();
>                     MainFormInit(frmP);
>                     FrmDrawForm(frmP);
>                     handled = true;
>                     break;
>
>             case frmUpdateEvent:
>                     break;
>
>           case penDownEvent:
>                    if (RctPtInRectangle(eventP->screenX,
>                         eventP->screenY, &gDrawRect))
>                    {
>                             gX = eventP->screenX;
>                             gY = eventP->screenY;
>                             gPenDown = true;
>                             handled = true;
>                    }
>                    break;
>
>           case penMoveEvent:
>                    if (RctPtInRectangle(eventP->screenX,
>                         eventP->screenY, &gDrawRect) && gPenDown)
>                    {
>                             Int16 newX = eventP->screenX;
>                             Int16 newY = eventP->screenY;
>
>                             WinDrawLine(gX, gY, newX, newY);
>                             gX = newX;
>                             gY = newY;
>                             handled = true;
>                    }
>                    break;
>
>           case penUpEvent:
>                    if (RctPtInRectangle(eventP->screenX,
>                         eventP->screenY, &gDrawRect) && gPenDown)
>                    {
>                              Int16 newX = eventP->screenX;
>                              Int16 newY = eventP->screenY;
>
>                             WinDrawLine(gX, gY, newX, newY);
>                             gX = gDrawRect.topLeft.x;
>                             gY = gDrawRect.topLeft.y;
>                             gPenDown = false;
>                             handled = true;
>                    }
>                    break;
>
>             default:
>              break;
>
>         } // end of switch
>
>         return handled;
>
> }



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

Reply via email to