On resizing a TextComponent dynamically
Posted: Wed Aug 04, 2010 22:21
Dear CEGUI Forum Denizens:
I have a custom widget. It has an imagery section called label, which I would like to resize horizontally dynamically.
I don't want to resize the whole widget, just the label.
I've noticed that when you get a named imagerysection in code, you can't get any information on the components it contains. You can add them, but not retreive or replace them.
<ImagerySection name="label">
<TextComponent>
<Area>
<Dim type="TopEdge">
<AbsoluteDim value="0" />
</Dim>
<Dim type="LeftEdge">
<AbsoluteDim value="31" />
</Dim>
<Dim type="RightEdge">
<UnifiedDim scale="1" offset="-3" type="RightEdge" />
</Dim>
<Dim type="BottomEdge">
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
</TextComponent>
</ImagerySection>
In code, this translates to an imagerysection object with a textcomponent area. I want to change the right edge to a different unified dim. I'm also having trouble with this because I'd like to get the current width of this component so that I could compare it to the horiz. extent of some text, but I can't get that value from the imagerlysection as far as I can tell. Could someone please explain how to access this data?
Also, let's say that I wanted to make the textcomponent above refer to a named area for its dimensions. That way, I could just edit the named area. How would I do that?
Thanks a lot for your help!
I have a custom widget. It has an imagery section called label, which I would like to resize horizontally dynamically.
I don't want to resize the whole widget, just the label.
I've noticed that when you get a named imagerysection in code, you can't get any information on the components it contains. You can add them, but not retreive or replace them.
<ImagerySection name="label">
<TextComponent>
<Area>
<Dim type="TopEdge">
<AbsoluteDim value="0" />
</Dim>
<Dim type="LeftEdge">
<AbsoluteDim value="31" />
</Dim>
<Dim type="RightEdge">
<UnifiedDim scale="1" offset="-3" type="RightEdge" />
</Dim>
<Dim type="BottomEdge">
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
</TextComponent>
</ImagerySection>
In code, this translates to an imagerysection object with a textcomponent area. I want to change the right edge to a different unified dim. I'm also having trouble with this because I'd like to get the current width of this component so that I could compare it to the horiz. extent of some text, but I can't get that value from the imagerlysection as far as I can tell. Could someone please explain how to access this data?
Also, let's say that I wanted to make the textcomponent above refer to a named area for its dimensions. That way, I could just edit the named area. How would I do that?
Thanks a lot for your help!