> From: Brian Smith
>
> Is it possible to make buttons or gadgets that aren't "regularly" shaped?
> (Square, round, rectangle or rounded rectangle.) I would like to divide a
> roughly rectangular large shape (almost the full screen) into irregularly
> shaped areas, each that would have some action associated with it when
> tapped.
>
AFAIK, the coordinates for each object are stored in a RectangleType. So, a
gadget's actual bounds are rectangular, though you can draw whatever you
like inside (or outside) those bounds.
> Alternatively, if I just draw one large bitmap and draw lines on it to
> divide it into my irregularly shaped areas, is there an easy way to tell
> which of the irregularly shaped areas is tapped? I'm thinking about how
> Windows Paint can "fill" an area with a color, with the little paint can
> tool, so it must have a way to figure out the boundaries of an irregularly
> shaped area. Can the Palm do the same thing? If so, I can get the
> coordinates of the screen tap, then see if it's inside any of my irregular
> shapes, and if so, handle the tap accordingly.
>
Don't bother with a large bitmap unless you want something more on it than
just the lines. You can draw lines with WinDrawLine(), WinPaintLine() or
WinPaintLines().
To check for pen taps, you have to trap Pen events in your event loop, then
look at the coordinates to see where they were.
The way Windows Paint fills an area when you use the fill tool is to look at
the pixel at the coordinate where you clicked to get its color (c1), then
scan outwards from that point, changing each pixel with color c1 to the fill
color, and stopping when it finds a pixel that is not color c1 (or when it
reaches the edge of the bitmap). You could do the same thing under the Palm
OS, but it would be a little slow.
The best advice I can give you is to consider not using too many irregularly
shaped objects in a Palm app.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/