Ben Combee wrote:
At 12:02 PM 11/18/2004, you wrote:
I show a bitmap in my application that is composed by some irregular
forms. I'd like to enable an user to select the operation to perform
by clicking in one of these forms. For example, let's say I show a
simple picture of a computer, where there is a monitor, a keyboard,
the CPU, a mouse, etc. If the user clicks on the part of the image
that represents the mouse, I'd like to open a form with information
about a mouse, if it clicks the monitor, show a form with information
about a monitor, etc.
Does anyone knows an easy way to do this? When the user clicks in a
given point in the screen, I only have its coordinates, but how can I
associate them with an object within the picture? I can imagine two
solutions, but none of them seems good to me:
1. Associate each component of the picture with some well defined
forms, as rectangles, and verify if the clicked point is within one of
them. I'll probably be hard (or at least boring) to implement and the
results would be rough.
I think this approach is best. I'd look at how websites implement
imagemaps; there are some editors that will let you draw rectangles in
your bitmap and will output a set of rectangle coordinates that you can
then encode in your program.
Thanks Ben, it's working fine now. I created a function that verifies
if a point is located inside a polygon and used GIMP to generate the
image map with the polygons. Since I'm parsing the image map to create a
header file with the polygon's coordinates, it's quite easy to update
the image and/or the mappings.
Luciano Stertz
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/