+2
Fixed

valignment seems to be broken

storycode 12 years ago updated by icahill (Administrator) 12 years ago 10
With the following example I would expect three boxes with the first box containing text top left aligned, the second box containing centered text, the third box containing text bottom right aligned. Instead only the horizontal alignment seems to work.


<wire>

<main>

<text name="text1" align="center" ypos="100" width="600" height="150" borderwidth="2" bordercolor="#ffffff" alignment="left" valignment="top" color="#ffffff" font="georgia" size="20" text="This has alignment=left, valignment=top" />
<text name="text2" bottomof="text1" align="center" width="600" height="150" borderwidth="2" bordercolor="#ffffff" alignment="center" valignment="center" color="#ffffff" font="georgia" size="20" text="This has alignment=center, valignment=center" />
<text name="text3" bottomof="text2" align="center" width="600" height="150" borderwidth="2" bordercolor="#ffffff" alignment="right" valignment="bottom" color="#ffffff" font="georgia" size="20" text="This has alignment=right, valignment=bottom" />

</main>

</wire>
Gavin,

Let me take a look at this issue. I will get back with you.
It turns out that valignment is currently only supported on the textfield tag. I have updated the documentation. However, you can still accomplish this task by wrapping your text tags in panels to achieve the same effect:



<wire>

<main>
<panel name="one" ypos="100" align="center" width="600" height="150" bordercolor="ffffff" borderwidth="3" leftpad="8">
<text name="text1" align="center" valign="top" width="600" height="fit" alignment="left" color="#ffffff" font="georgia" size="20" text="This has alignment=left, valignment=top" />
</panel>
<panel name="two" bottomof="one" align="center" width="600" height="150" bordercolor="ffffff" borderwidth="3">
<text name="text1" align="center" valign="center" width="600" height="fit" alignment="center" color="#ffffff" font="georgia" size="20" text="This has alignment=center, valignment=center" />
</panel>
<panel name="three" bottomof="two" align="center" width="600" height="150" bordercolor="ffffff" borderwidth="3" rightpad="8">
<text name="text1" align="center" valign="bottom" width="600" height="fit" alignment="right" color="#ffffff" font="georgia" size="20" text="This has alignment=right, valignment=bottom" />
</panel>
</main>

</wire>
This is not a solution for this case:

If we replace a text object's text on the fly the height is not recalculated when the 'fit' attribute is used. This means that text objects that have dynamic text must have a fixed height, which in turn means that you can only ever have the text vertically centered.
In this new scenario you presented, you may try to use a create tag for your three panels. This will ensure that they are dynamically generated based on a class or series of classes you are defining.
Wow that's an awful lot of work to go to just to vertically align text in a fixed sized box...
I am sorry I wasn't very clear in my last comment.

We are aware of an issue with text tags that do not allow then to wrap text. Because of this issue fit height functions a bit different when you replace the text value using an assign or similar action. We have an active ticket logged for the matter and hope to resolve it soon.

I was offering the create option as a possible workaround in the meantime.
Perhaps 'valignment' support could be added to the text object soon. It would complement the 'alignment' attribute and make vertical positioning of text simpler.
I absolutely agree. A ticket has been created for this as well.
I am having this issue also. Makes it difficult to bring in tweets and format for readability.
Michael,

Thanks for the comment. I will check with the features team and see where this ticket is.