Finding Mouse Coordinates

kirkm

Registered User.
Local time
Today, 19:04
Joined
Oct 30, 2008
Messages
1,257
Hi, I have an Access 2007 continuous view Form and would like to capture the mouse X=-Y coordinates to set the start up position for a small Form.

I hoped to use MouseMove method, but this does not work.

Any help with this very much appreciated.
 
mousemove, mouseup and mousedown all provide the XY coordinates of the mouse so if it doesn't work, this implies either the code you are using is wrong or you have a muisunderstanding about when these events are triggered.

Perhaps if you explained what you are trying to do and what you have tried so far, someone can help
 
You think mousemove should work on a Form set to continuous view? The Form is completely covered by text box controls (similar to datasheet view) and the mouse isn't 'on' the Form itself.. Private Sub Form_MouseMove is not being called as the mouse travels over the controls on the Form.

So some other method for getting the mouse coordinates is what I'm looking for.
 
Further to CJ's comment, have you seen the example here?

Have you tried google

MSACCESS vba example mousemove events or similar
 
Thanks for reply jdraw. Yes I've been Googling for several days and have tried that example.
Label Coordinates isn't ever populated (actually Private Sub Detail_MouseMove isn't called).
There's very few examples for Access to be found. I suspect it can only be done by advanced methods beyond basic stuff, and hoping someone here may have done so.
 
You think mousemove should work on a Form set to continuous view?
yes - but whether it does what you want is an unknown since you have not clarified what you are trying to do. the mousemove event is triggered when the mouse moves over something - that might be the header, detail, footer or a control - a control will 'hide' the mouse from anything behind it, so if you are saying this

The Form is completely covered by text box controls
then these controls will 'hide' the form, so you need to put your code on all of the controls instead
 
I will keep searching... but think something other than the mousemove event is needed here. The Form MouseMouse event isn't returning anything in this case and the controls mousemove return values relative to the control whereas I need it relative to the Form
Actually I only need the Y value as the horizontal position is known.

I'm sure this can be done somehow! And thanks for the suggestions.
 
>you have not clarified what you are trying to do
Sorry CJ. line one of msg#1 was my attempt at that.
I don't know if it would be possible to use mousemouse from every control to calculate it's position . There's 18000 rows with about 25 on screen at a time.
 
Left is a constant. Is Y vertical? (I'm confused now). Either way I don't see it helping. The Top property is always 0. I do know the row number. But that isn't much use as how could you calculate where they have scrolled to ?
 
CJ, this is looking more like it, although not quite out of the woods yet.
I presume I'd need to check the user has the .net framework. Or is that a given these days?

So far I can't get Public Shared ReadOnly Property MousePosition As Point to compile in the Declarations area of the Form. I did add a Reference to system.windows.forms.dll but it didn't appear to make any difference.
 
regret I don't have time to do the research

presume I'd need to check the user has the .net framework. - possibly, I don't know
 
Thanks very much for getting me this far. All the best.
 

Users who are viewing this thread

Back
Top Bottom