repositionByPercent
Moves a component to an absolute position, defined as a percentage of container width and height.
Alternatively, you can specify a component’s position by pixel. For more information, see reposition on page 174.
Syntax
ogscript.repositionByPercent (OID, x percent, y percent, center x, center y);
Parameters
Parameter |
Type |
Required |
Description |
OID |
String |
Yes |
OID of the component you want to reposition |
x percent |
Integer |
Yes |
Distance from the left, as a percentage of container width |
y percent |
Integer |
Yes |
Distance from the top, as a percentage of container height |
center x |
Boolean |
Yes |
true — Shows the full width of the object. false — Crops the object if it extends beyond the horizontal boundaries of the container. |
center y |
Boolean |
Yes |
true — Shows the full height of the object. false — Crops the object if it extends beyond the vertical boundaries of the container. |
Returns
N/A
Example
In this example, the task associated with the One Quarter button uses the ogscript.reposition function to reposition a label 25% from the left, and 25% from the top. Centering is set to false in both the x and y axes, so if the label overhangs the edges of the container the overhanging portion is not shown.
<labelheight="41" id="myLabel" left="160" name="myLabel" style="txt-align:center" top="101" width="160"/>
<buttonbuttontype="push" height="40" left="160" name="One Quarter" top="200" width="159">
<task tasktype="ogscript">ogscript.repositionByPercent('myLabel', 25, 25, false, false);
</task>
</button>