Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I determine the x,y coordinates of an object?
Message
From
26/01/2009 07:29:41
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01376952
Message ID:
01376988
Views:
17
>>Need to move the mouse to the upper left corner of a control under certain circumstance. Can already move the mouse using SetCursorPos in WIN32API, but how can I determine the x,y position of the object? I've tried messing around with form and object top and left properties, but the form top is 0, but it's not really. As far as the API is concerned, the form top is in relation to the top of the screen.
>
>Check if http://berezniker.com/content/pages/visual-foxpro/pixels-and-foxels may be helpful.

I actually thought that might help, but it puts the cursor very close to the upper/left corner of the screen (top application) window. This is the code I'm trying to use:
IF (nKeyCode >= 48 AND nKeyCode <= 57) OR (nKeyCode >= 65 AND nKeyCode <= 90) OR (nKeyCode >= 97 AND nKeyCode <= 122)

	m.lnPosY = _SCREEN.Top + THISFORM.Top + VAL(ALLTRIM(STR(OBJTOCLIENT(This,1)))) && I also tried just THIS.Top here
	m.lnPosX = _SCREEN.Left + THISFORM.Left + VAL(ALLTRIM(STR(OBJTOCLIENT(This,2)))) && I also tried just THIS.Left here

	lnRow = pix2fox(lnPosY, .T.,_screen.Fontname ,_screen.FontSize)
	lnCol = pix2fox(lnPosX, .F.,_screen.Fontname ,_screen.FontSize)

	=SetCursorPos(lnRow,lnCol)

ENDIF

DODEFAULT()
All I want to do is move the mouse to the top/left corner of the object that the KeyPress is running in.
Previous
Reply
Map
View

Click here to load this message in the networking platform