Andrew said:
Hi Dirk,
Thanks for your reply - I've seen your replies before and noticed
you're very helpful.
Before logging my question I'd seen a few postings about the 'mouse
move event' but I couldn't see how to get the x & y coordinates. Can
you please explain it for me a little?? All I could see was how to
kick off a procedure (on mouse move)
If you create an event procedure for the mousemove event of a control or
section, the declaration of that procedure will look something like
this:
Private Sub ControlName_MouseMove(Button As Integer, Shift As Integer, X
As Single, Y As Single)
(Note: that was entered all on one line, but it will have been broken
onto two or more lines by the newsreader.)
The arguments are as follows (quoted from the Access 97 help file, since
the later versions' help files either don't contain this detail or
aren't indexed so that I can find it):
Button -
The state of the mouse buttons when the event occurs.
If you need to test for the Button argument, you can use
one of the following intrinsic constants as bit masks:
acLeftButton -
The bit mask for the left mouse button.
acRightButton -
The bit mask for the right mouse button.
acMiddleButton -
The bit mask for the middle mouse button.
Shift -
The state of the SHIFT, CTRL, and ALT keys
when the button specified by the Button argument
was pressed or released. If you need to test for the
Shift argument, you can use one of the following
intrinsic constants as bit masks:
acShiftMask -
The bit mask for the SHIFT key.
acCtrlMask -
The bit mask for the CTRL key.
acAltMask -
The bit mask for the ALT key.
X, Y -
The x and y coordinates of the current location
of the mouse pointer. The X and Y arguments are
always expressed in twips.
Thus, if you create a MouseMove event procedure for the control in
question, you can check the values of the X and Y arguments that are
passed to that procedue to find out where the mouse pointer is.
Here's a very simple example:
'----- start of code -----
Private Sub Image1_MouseMove( _
Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
SysCmd acSysCmdSetStatus, "The mouse is at (" & X & ", " & Y & ")."
End Sub
'----- end of code -----
As mentioned abovem the X and Y coordinates are expressed in twips (1
twip = 1/1440 inch). I believe they are given relative to the top left
corner of the control.