Hello,
I'm trying to determine if the user placed their pen down on a non-silk area
of the screen. Does anyone know the proper way of doing this?
I can capture the penDown event easy enough, however, I noticed that it is
fired for any coordinate on the entire screen, including the silk area. I
found a function which returns the area of the silk screen, however, I'm
having a problem calling it; it crashes the simulator. I may just have the
function result declared incorrectly. Also, if there is a better way of
doing this I would greatly appreciate knowing it. Thanks:
Int16 newX, newY;
Boolean penDown;
UInt32 screenWidth;
UInt32 screenHeight;
const SilkscreenAreaType *silkScreens;
UInt16 *numAreas = 0;
int i, j;
UInt32 displayWidth, displayHeight;
EvtGetPen(&newX, &newY, &penDown);
if (penDown) {
WinScreenGetAttribute(winScreenWidth, &screenWidth);
WinScreenGetAttribute(winScreenHeight, &screenHeight);
displayWidth = screenWidth;
displayHeight = screenHeight;
silkScreens = EvtGetSilkscreenAreaList(numAreas);
//j = sizeOf(silkScreens[0]);
j = 1; // I don't know which heard file sizeOf is declared in, or if
there is a SDK equivalent.
for(i=0;i<j;i++) {
if (silkScreens[i].areaType == silkscreenRectScreen) {
displayWidth -= silkScreens[i].bounds.extent.x;
displayHeight -= silkScreens[i].bounds.extent.y;
break;
}
}
if ((newX <= displayWidth) && (newY <= displayHeight))
// Pen press in non-silk area
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/