PDA

View Full Version : Text moving after modifying field[livename].text


Mathias
January 25th, 2009, 06:29 PM
For my skills with domains, I'm adding a script to modify field[livename].text once the domain is entered. What's weird is that the name portal repositions itself after this happens. I have an explicit field[name].left = 0 line in the position script. The name portal always shifts right (unless a very long domain is entered, and the text is cut off) - it's as if the text went from being left-aligned to right-aligned within the name portal.

What am I missing?

rob
January 30th, 2009, 02:15 PM
I have no idea what's going wrong. Please email me or Colen the data files and we can take a look to see what's gone sideways.

rob
February 3rd, 2009, 12:40 AM
After taking a look at the data files you sent, the problem is the combination of positioning logic and style used on the portal. The "name" portal is using the "lblNormal" style. If you take a look at this style in "styles_ui.aug", you'll see that it specifies "align=center". This will center the text horizontally within the width of the portal. You are calculating the width of the portal to use a fixed span that is much wider than the actual text being displayed within the portal. This results in the name of the skill being centered within the span you specified for the portal.

The solution is to do one of two things. Option #1 is to change to the "lblLeft" style, which will cause the text in the portal to always be left-aligned instead of centered. Option #2 is to use the same basic logic that you chose not to use when the "domain" is present and that was previously used in the Position script. The original code set the width of the name portal to be the smaller of the name width or the space available. This results in the name always being left-aligned within the portal, since the portal is always the size of the name text or smaller.