Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoid overlapping objects or SYS(1270)
Message
From
12/03/1999 21:07:43
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00196959
Message ID:
00197122
Views:
19
Can I assume that "global coordinates" means screen coordinates?

You may want to take a look at the code in my FancyToolTip control (in the Files section). I use there several tricks and API functions to get all kind of coordinates, objects under the object under mouse cursor, objects at specific coordinates.

Maybe it helps using API functions for windows. Any VFP form has a window handle (HWND), so, it also has a client area, etc. This should get you to the window area without the toolbars. There is also an API function that returns the window at specified screen coordinates (WindowFromPoint()).

For you specific question (but maybe this is not exactly what you need, but just part of a solution?): Use the ClientToScreen() Win32 API function. It takes a window handle and a point as parameters. The HWND is the handle of the client area of a window and the point is any point inside this area. It returns the equiv coordinates relative to the screen (into the same Point parameter).

Vlad

>As documented, SYS(1270, nX, nY) returns a reference to the object at location(nX, nY), if any. In other words, I'm trying to use SYS(1270) to identify and reference objects in forms.
>The problem is that nX and nY are absolute coordinates; neither relative to the form nor to the main VFP window. So, in order to avoid overlapping objects or even referencing objects at certain locations one has to translate the position within the form that contains the object to absolute coordinates, which can be done using SYSMETRIC() to calculate dimensions of form's title and frame. The catch is that the form must be defined in desktop (form.desktop = .T.).
>My question is how could one translate local coordinates in forms contained in the VFP window (form.desktop = .F.) to global coordinates.
>NOTE: consider also that some toolbars may also be active and docked at the top or leftmargin of the screen, which affect (or not affect, rather) the form's Left and Top properties.
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform