# Mouse event

Hello,
I have figured out how to read the mouse info inside a canvas on the window.

## My program displays a group of circles with a for next loop and I plot the data according to my array data.

Example:
For I = 0 to 105
G.drawoval(myarray(I).x, myArray(I).y,15,15)

Next I

I figured out how to display the mouse X,y on the canvas, but how would I display the name of the circle data when I move the mouse?

I know I need the myArray(I).name inside the for next loop,but how do I make the mouse check to see that the mouse is over the data spot?
Thanks,
Pat

do a little math.

your circle is in a rectangle with upper left corner at myArray(i).x,myArray(i).y and is 15 wide and 15 high

therefore the CENTER of your circle is myArray(i).x+7.5,myArray(i).y+7.5
measure the distance from THAT point to mouse X,Y and if less or equal to 7.5 then mouse is INSIDE your circle

The circles are not actually 0,0

The actual values are:

For I = 0 to 105
(Myarray(I).x+2)*19, (myArray(I).y+2)*19), 15,15
Next i

so? the math is the same… I’m ASSUMING you understand basic Geometry…
find the center of the circle and detemine if the distance from that point to the mouse is less or equal to the radius of the circle