4D v16.3OBJECT GET COORDINATES |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
OBJECT GET COORDINATES
OBJECT GET COORDINATES
The OBJECT GET COORDINATES command returns the coordinates left, top, right and bottom (in points) in variables or fields of the object(s) of the current form defined by the parameters * and object. If you pass the optional parameter *, it indicates that the object parameter is an object name (a string). If you don’t pass the optional parameter *, it indicates that object is a field or a variable. In this case, you don’t pass a string but a field or variable reference (only a field or variable of type object). If you pass an object name to object and use the wildcard character (“@”) to select more than one object, the coordinates returned will be those of the rectangle formed by all the objects concerned. Note: Since 4D version 6.5, it is possible to set the interpretation mode of the wildcard character (“@”), when it is included in a string of characters. This option has an impact on the “Object Properties” commands. Please refer to the 4D Design Reference manual. If the object doesn’t exist or if the command is not called in a form, the coordinates (0;0;0;0) are returned. In the context of list boxes, the OBJECT GET COORDINATES command can return the coordinates of specific list box parts, i.e. columns, headers, or footers, and not just those of the list box parent object. In 4D versions prior to v14 R5, this command always returned the parent list box coordinates, regardless of the area passed as parameter. From now on, when the referenced object is a list box header, column, or footer sub-object, the coordinates returned are those of the designated list box sub-object. You can use this new feature, for example, to display a small icon in the list box header cell when it is hovered over, which a user can then click to display a context menu.
For example, consider the following graphic where the coordinates of the Capital column are symbolized by the red rectangle: As you can see in the first picture, the column is larger than the list box, so its coordinates go beyond the lower limit of the list box, including the footer. In the second picture, the list box has scrolled, so the column has also been moved "under" the Language column and header area. In any case, in order to calculate the actual visible part (green area), you need to subtract the red areas. Let’s assume that you want to obtain the coordinates of a rectangle formed by all the objects that begin with “button”: OBJECT GET COORDINATES(*;"button@";vLeft;vTop;vRight;vBottom) For interface needs, you want to surround the clicked area with a red rectangle: In the object method of the list box, you can write: OBJECT SET VISIBLE(*;"rectangleInfo";False) //initialize a red rectangle The method returns theoretical coordinates. In cases where the list box has been resized, you may need to calculate the clipping to know which part is visible:
See also
CONVERT COORDINATES
|
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v6.7 ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||