"Karlheinz Toni" <[EMAIL PROTECTED]> wrote in message news:73654@palm-dev-forum... > > Hi there, is there any possibility to draw in a gadget in a form, so thatI > can use the buttons and lists in the rest of the form? > > > Because if I use the following code: > > static Boolean MainFormHandleEvent(EventPtr eventP) > { > Boolean handled=false; > Coord x,y; > FormPtr frmP = FrmGetActiveForm(); > > switch(eventP->eType) { > case frmOpenEvent: > MainFormInit( frmP); > FrmDrawForm ( frmP); > handled = true; > break; > case penDownEvent: > pX=eventP->screenX; > pY=eventP->screenY; > //Draw a dot at x,y > SetCol(); > WinDrawPixel(pX,pY); > handled=true; > break; > case penMoveEvent: > x=eventP->screenX; > y=eventP->screenY; > //Draw a line > SetCol(); > WinDrawLine(pX,pY,x,y); > pX=x; > pY=y; > handled=true; > break; > } > return handled; > } > > I can only draw on the form and not on a gadget.
This code has a few problems. First, you aren't hit testing your penDownEvent to make sure it lies in the rectangle of the gadget. By absorbing the event, you prevent it from getting to the built-in code that checks to see if you tapped on a control. Only act and set handled to true if you've first determined that the pen is down inside the gadget. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
