There used to be a sample app posted on PalmSources's site called
SignatureCapture.
Here's a code peice that I've used to build a full sig capture control. It
uses a Gadget control. It calls a function AddPoint that stores the points in
a buffer and takes a parameter of true or false whether its a starting point.
-Dave
/**************************************************************************************************
* FUNCTION: SigCapSingleFormHandleEvent
*
* DESCRIPTION: Handles processing of events for the SigCapture form.
**************************************************************************************************/
Boolean SigCapSingleFormHandleEvent(EventPtr eventP)
{
FormPtr frmP = FrmGetActiveForm();
Boolean handled = false;
UInt16 objIndex;
RectangleType r;
switch (eventP->eType) {
case frmOpenEvent:
FrmDrawForm(frmP);
FrmGetObjectBounds (frmP, FrmGetObjectIndex (frmP,
SigCapSingleInput1Gadget), &r);
WinEraseRectangle (&r, 1); // clear box
WinDrawRectangleFrame(roundFrame, &r); // draw border
MemHandleUnlock (sigHandle1);
handled = true;
break;
case penDownEvent:
objIndex = FrmGetObjectIndex (frmP, SigCapSingleInput1Gadget);
FrmGetObjectBounds (frmP, objIndex, &r);
// Check to see if pen down is in the first gadget
if (RctPtInRectangle (eventP->screenX, eventP->screenY, &r)) {
GadgetTapped (1, SigCapSingleInput1Gadget);
handled = true;
}
break;
}
return(handled);
}
/**************************************************************************************************
* FUNCTION: GadgetTapped
*
* DESCRIPTION: Handles processing of strokes on the gadget for the Signature
capture.
**************************************************************************************************/
void GadgetTapped(UInt16 SigBox, UInt16 GadgetID)
{
UInt16 objIndex;
FormPtr frmP;
RectangleType r;
Int16 x, y, x1 = 0, y1 = 0;
Boolean penDown;
frmP = FrmGetActiveForm();
objIndex = FrmGetObjectIndex (frmP, GadgetID);
FrmGetObjectBounds (frmP, objIndex, &r);
do {
PenGetPoint (&x, &y, &penDown);
if (y != y1 || x != x1) { // Throw away all of the repeat events with
the same coordinates
// If all points are in the bounds of the gadget and this isn't the
first point
if (RctPtInRectangle (x, y, &r) && RctPtInRectangle (x1, y1, &r) &&
x1 && y1) {
WinDrawLine (x, y, x1, y1); // Draw a line on the Palm from
the previous pen point to the new point
AddPoint (x - x1, y - y1, false);
} else if (RctPtInRectangle (x, y, &r)) { // add a starter point
AddPoint (x - r.topLeft.x, y - r.topLeft.y, true);
}
x1 = x;
y1 = y;
}
} while (penDown);
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/