Please enable JavaScript to view this site.

ESL Documentation

Object Inquiry Built-in Functions

Return the X and Y coordinates of the middle of an object's contents.

{xmiddle|ymiddle} of OBJECT_NAME

OBJECT_NAME

The identifier for an object.

Description

The values returned are based upon the values of the top, bottom, left, and right functions, and are expressed in the coordinates of the object. If the object has no contents, ESL returns values of zero for these functions. The values returned are calculated as:

xmiddle of =

(left + right)

 

2

ymiddle of =

(top + bottom)

 

2

For graphical objects, these functions return X and Y coordinates. For textual regions, these functions return column and line numbers.

Avoid using the xmiddle of or ymiddle of functions for a scaled graphical region that contains text, or in a program whose defined screen size is different from the display resolution. Since text does not scale, the xmiddle of and ymiddle of functions return incorrect values in these situations.

The keyword of is not required when you use these functions in a drawing statement.

Example

 

response to More_GR

 add to Box_GR

 move to (xmiddle of Box_GR) (ymiddle of Box_GR)

 circle radius 1

See Also

top of, bottom of, left of, and right of Object Inquiry Built-in Functions