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!
On resizing a TextComponent dynamically
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 6
- Joined: Wed Aug 04, 2010 21:57
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: On resizing a TextComponent dynamically
Ok. First my excuses! This area of the system was written in a YAGNI style. And I was right, I didn't need it - it's just that some of you guys did!
More seriously, if you need to modify dimensions of some area defined for skin component you should define a property and use PropertyDim to refer to that property in the Area definition (it also allows you to read the current value, of course). The property based approach means the changes and values are per-window, which in most cases is what people want / need - I'm not sure if this is true in your case, if not there are issues regarding fetching a defined UDim, because it's final dimension is tied to some base dimension (i.e. the window width or height of the window the skin is associated with).
That's a TODO item, and one I'm surprised does not get asked about more often.
CE.
More seriously, if you need to modify dimensions of some area defined for skin component you should define a property and use PropertyDim to refer to that property in the Area definition (it also allows you to read the current value, of course). The property based approach means the changes and values are per-window, which in most cases is what people want / need - I'm not sure if this is true in your case, if not there are issues regarding fetching a defined UDim, because it's final dimension is tied to some base dimension (i.e. the window width or height of the window the skin is associated with).
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?
That's a TODO item, and one I'm surprised does not get asked about more often.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
-
- Just popping in
- Posts: 6
- Joined: Wed Aug 04, 2010 21:57
Re: On resizing a TextComponent dynamically
Thanks a bunch. Got it working. Part of the trouble was that I'm running an old version (0.6.1) where the factory registry process is still defined in macros instead of templates, and I was having a hard time reading them or finding docs. Figured it out, though.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 11 guests