Just a followup.... I know I was declaring and using a few variables
incorrectly (it was 2am when I wrote the code and I was tired).
const SilkscreenAreaType *silkScreens;
UInt16 *numAreas = 0;
.
.
silkScreens = EvtGetSilkscreenAreaList(numAreas);
should've been:
const SilkscreenAreaType silkScreens;
UInt16 numAreas = 0;
.
.
silkScreens = EvtGetSilkscreenAreaList(&numAreas);
Even so, I found a better function, by purusing other posts here, to get the
display size. Here's my final (working) code:
Int16 newX, newY;
Boolean penDown;
Coord extentX, extentY;
EvtGetPen(&newX, &newY, &penDown);
if (penDown) {
WinGetDisplayExtent(&extentX, &extentY);
if (newY <= extentY)
// Pen pressed in non-silk area
}
"Edward J. Stembler" <[EMAIL PROTECTED]> wrote in message
news:106952@palm-dev-forum...
>
> 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/