4D v16.3CONVERT COORDINATES |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
CONVERT COORDINATES
CONVERT COORDINATES
The CONVERT COORDINATES command converts the (x;y) coordinates of a point from one coordinate system to another. The input and output coordinate systems supported are forms (and subforms), windows, and the screen. For example, you can use this command to get the coordinates in the main form of an object belonging to a subform. This makes it easy to create a context menu at any custom position. In xCoord and yCoord, pass as variables the (x;y) coordinates of the point you want to convert. After the command is executed, these variables will contain the converted values. In the from parameter, pass the initial coordinate system the input point is using, and in the to parameter, pass the coordinate system into which it must be converted. Both parameters can take one of the following constant values, added to the "Windows" theme:
When this command is called from the method of a subform or a subform's object, and if one of the selectors is XY Current form, then the coordinates are relative to the subform itself, not to its parent form. When converting from/to the position of a form window (for example when converting from the results of GET WINDOW RECT, or to values passed to Open form window), XY Main window must be used since it is the coordinate system used by window commands on Windows. It can also be used for this purpose on OS X, where it is equivalent to XY Screen. When from is XY Current form and the point is in the body section of a list form, the result depends on the calling context of the command:
You want to open a pop-up menu at the bottom left corner of the "MyObject" object. // OBJECT GET COORDINATES works in the current form coordinate system You want to open a pop-up window at the position of the mouse cursor. On Windows, you need to convert the coordinates since GET MOUSE (with the * parameter) returns values based on the position of the MDI window: C_LONGINT($mouseX;$mouseY;$mouseButtons)
See also
GET WINDOW RECT
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v15 R3 ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||