Can a function know the mouse coordinates

J

Jesper F

I have a grid of 9x9 buttons and I need to know the cursor's xy coordinates
over the buttons at all times.
If use the MouseMove event of each button I can do this, but I'd prefer to
have my own fMouseMove function and then assign it to all the command
buttons in their property sheet with "=functionname" - simply to reduce the
amount of similar code.
Can this be done?
I'm affraid it can't since my own function can't catch the xy coordinates as
the built-in mousemove-event can.
Thanks.
 
M

Marshall Barton

Jesper said:
I have a grid of 9x9 buttons and I need to know the cursor's xy coordinates
over the buttons at all times.
If use the MouseMove event of each button I can do this, but I'd prefer to
have my own fMouseMove function and then assign it to all the command
buttons in their property sheet with "=functionname" - simply to reduce the
amount of similar code.
Can this be done?
I'm affraid it can't since my own function can't catch the xy coordinates as
the built-in mousemove-event can.


I think, maybe you could do that by sinking the events to
your own class module, but I would attack the problem
differently.

Create a big, transparent button on top of all 81 buttons.
The big button will recieve all the mouse move and click
events so you can do whatever you need in one place and
translating the coordinates from the big button to the
specific little button is just a matter of some arithmetic..
 
J

Jesper F

Awesome. I had tried this with different combinations of transparent
textboxes, frames and other stuff but not the transparent button (it stays
in the front).
I've already made the function for catching coordinates and acting
appropriatly so all is running now.
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top