SVG element ID by coordinates

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11.3


SVG element ID by coordinates ({*; }pictureObject; x; y) String

ParameterTypeDescription
**If specified, pictureObject is an object name (string)
If omitted, pictureObject is a field or variable
pictureObjectPictureObject name (if * specified) or
Field or Variable (if * omitted)
xLongintX coordinate in pixels
yLongintY coordinate in pixels
Function resultStringID of element found at the location X, Y

Description

La command SVG element ID by coordinates command returns the ID ("id" or "xml:id" attribute) of the XML element found at the location set by the coordinates (x,y) in the SVG picture designated by the pictureObject parameter. This command can be used more particularly to create interactive graphic interfaces using SVG objects.

Note: For more information about the SVG format, please refer to the Overview of XML Utilities Commands section.

If you pass the optional * parameter, you indicate that the pictureObject parameter is an object name (string). If you do not pass this parameter, you indicate that the pictureObject parameter is a field or variable. In this case, you do not pass a string but a field or variable reference (field or variable object only).

Note that it is not mandatory for the picture to be displayed in a form. In this case, the "object name" type syntax is not valid and you must pass a field or variable name.

The coordinates passed in the x and y parameters must be expressed in pixels relative to the top left corner of the picture (0,0). In the context of a picture displayed in a form, you can use the values returned by the MouseX and MouseY System Variables. These variables are updated in the On Clicked and On Double Clicked form events, as well as in the On Mouse Enter and On Mouse Move form events.

Note: In the picture coordinate system, [x;y] always specifies the same point, regardless of the picture display format, except in the case of the "Replicated" format.

The point taken into account is the first point reached. For example, in the case below, the command will return the ID of the circle if the coordinates of point A are passed and that of the rectangle if the coordinates of point B are passed:

When the coordinates correspond to superimposed or composite objects, the command returns the ID of the first object having a valid ID attribute by going back, if necessary, among the parent elements.

The command returns an empty string if:

the root is reached without an "id" attribute having been found,

the coordinates point does not belong to any object,

the "id" attribute is an empty string.

System Variables or Sets

If pictureObject does not contain a valid SVG picture, the command returns an empty string and the OK system variable is set to 0. Otherwise, if the command has been executed correctly, the OK system variable is set to 1.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next