iDevOS CALC "POSX" Command
Get the X position of an entity.
Description
CALC( x, page, name, "POSX" ); // x = posx("name" on "page") CALC( x, page, name, a, "POSX" ); // x = posx("name" on "page") + a
This command returns the value x
which is the display X-position of the entity name
on page
and adds a
, if provided.
Text, image, draw, touch key and page entities have positions. Other entities, such as variables, do not and will return 0
for their position.
The Y-position of an entity can be obtained using "POSY"
.
Parameters
x
- Calculation result.
Parameter type: entity name of a numeric variable (egU8
,S32
,FLT3
etc). page
- Page Name.
Parameter type: Immediate entity name. name
- Entity Name.
Parameter type: Immediate entity name. a
- Input value.
Parameter type: immediate number, or entity name of a numeric variable (egU8
,S32
,FLT3
etc). "POSX"
- CALC command operator.
Parameter type: immediate string.
Examples
Example 1
VAR(x, 0, S32); // Result variable VAR(y, 0, S32); // Result variable PAGE(pg1, stPg); { ... POSN(20, 30); DRAW(box, 50, 50, stBox); // Create a box ... } SHOW(pg1); CALC(x, pg1, box, "POSX"); // x = 20 CALC(y, pg1, box, "POSY"); // y = 30 CALC(x, pg1, box, 10, "POSX"); // x = 30 CALC(y, pg1, box, 10, "POSY"); // y = 40