Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Remove "in" units from X Coordinates

Avatar

Former Community Member
Does any know how to remove the "in" units from an x coordinate?
7 Replies

Avatar

Former Community Member
Not sure I follow ....do you want to work in different units?

Avatar

Former Community Member
When I get the X coord for an object in script. Text1.x it returns 2in but i need to take that value (without the units "in") and add a value to it.



Also, I am having some difficuly getting the width value of a textbox that expands to fit.



I want to position a help button after a textbox. I want to know the position of the textbox and the width. So i can set the X value of the help button.



Thanks,

Avatar

Former Community Member
I have an example of this on another computer that I cannot get to until next Tuesday....I will post the example then.

Avatar

Former Community Member
Sick.. I figured it out. Wrap the expandable text and help button in a subform and make the content Flowed - Western text.

Avatar

Former Community Member
That is not the way I would do it.

Here is some code that will give you the length of the field after rendering. You can change the units to any supported value at it will work fine. Note that this is javascript.



var oH = xfa.layout.w(txtDescription, "in");

this.w = oH + "in";



where txtDescription is the name of the field that you want to get the length of. This code wouldl be executed in the layout event of the object that you are trying to position.



Hope this helps

Avatar

Former Community Member
Would I be able to get the x/y coords as well by this approach?

xfa.layout.x(txtQuestion,"in");

xfa.layout.y(txtQuestion,"in");

Avatar

Former Community Member
Yes..that woudl be the absolute positioning after layout (useful in a flowed form). Not the x and y at Design time like in a static form.