Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine mouse pointer position.

Status
Not open for further replies.

MarkButler

Programmer
Feb 22, 2001
83
US
I need to find the mouse pointer position relative to _SCREEN not the form itself. Most the VFP functions return x/y coordinates relative to the top left of a container.

What I want to do is place a form on top of the active form just below the point where the mouse is currently located. I need to capture the x/y at the time the mouse is left clicked so when I activate the form I can move it to x/y which should be just below the point of the click.

Any suggestions?

TIA
 
MarkButler

In pixels:
MESSAGEBOX("X position: "+TRANSFORM(MCOL('',3))+CHR(13)+"Y position:"+TRANSFORM(MROW('',3)))

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
That is exactly what I needed. I kept trying to use MROW('_SCREEN',3) without success. Did not think to use a null value.

Thanx....
 
MarkButler

According to the help file
If you omit cWindowName and there is no active user-defined window, MCOL( ) returns the mouse pointer's column position in the main Visual FoxPro window.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top