Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Pennsylvania - United States
 Yuri Rubinov
 To: Atul Deshpande
  Where is Atul Deshpande?
 Atul Deshpande
Subject: RE: How to determine x & y coord.
Thread ID: 33966 Message ID: 33989 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: Grids
Date: Friday, December 05, 2003 5:43:49 PM         


The solution depends on how you would like to show X-Y coordinates and on what event. The following should help to get you started.

I assume you move the mouse over the object to get the global x-y mouse coordinates. Then you may recalculate X_Y values to show while substracting form (or appropriate window) top/Left values.

1. set form.scalemode to 3 (Pixels)
2. in the form.load add
Declare short GetCursorPos In win32api String @ lpPoint
3. in the form unload add
clear dlls
4. add two textboxes to show the mouse x-y coordinates, with names like txtXpos and txtYpos.
5. add a timer, set interval to 100 (or whatever), and in the timer.timer event add:
lpPoint = Space(8)
With Thisform
If GetCursorPos(@lpPoint)#0
.txtXPos.value = Asc(Substr(lpPoint,1))*256^0+;
.txtYpos.Value = Asc(Substr(lpPoint,5))*256^0+;

> I want to determine the x and y coord. of the current cell of a grid control. (It may be scrolled ) relative to form or grid. Anybody please give me Idea how to get it.
> atul


How to determine x & y coord. Posted by Atul Deshpande @ 12/5/2003 2:33:50 PM
RE: How to determine x & y coord. Posted by Yuri Rubinov @ 12/5/2003 5:43:49 PM