Hi,
I'm wondering how to define the look&feel of a button that uses a statictext for it's label (instead of a textcomponent) that should be accessible from code to get/set the statictext-properties.
The reason for that is the need of getting the VertExtent of the buttonlabel to adjust the button's height and setting the HorzFormatting.
Thanks for any advice
rob
StaticText as child of PushButton
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: StaticText as child of PushButton
First you remove any existing label ImagerySection and it's associated references in the StateImagery definitions. You then basically add the static text to the button via the <Child> component tag (http://cegui.org.uk/docs/current/fal_el ... _ref_sec_5). That will take care of one portion of the issue.
The second part is to expose the StaticText properties to the owning button, you can do this via the PropertyLinkDefinition element (http://cegui.org.uk/docs/current/fal_el ... ref_sec_27), which can be used to define new properties on the Button which will be linked to properties on some other element (usually a child).
CE
The second part is to expose the StaticText properties to the owning button, you can do this via the PropertyLinkDefinition element (http://cegui.org.uk/docs/current/fal_el ... ref_sec_27), which can be used to define new properties on the Button which will be linked to properties on some other element (usually a child).
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: StaticText as child of PushButton
Hi CE,
I'm running into some problems when adding a static-text-child to my button. I think the main issue is related to the nameSuffix in
<Child type="MyLookNFeel/StaticText" nameSuffix="__text">...</Child>
If it doesn't start with "__auto_" the static_text is created as a child that is selectable in the LayoutEditor and is a "real" child-window of my button... Unfortunately the loading of layout fails with "GUILayout_xmlHandler::startElement - layout loading has been aborted since Window named 'Root/Button__text' already exists." which makes somehow sense in that way...
If I add the "__auto_" (as seen in the other .looknfeel-files) the child is not created at all....
My simple-text-button:
any ideas?
thanks
I'm running into some problems when adding a static-text-child to my button. I think the main issue is related to the nameSuffix in
<Child type="MyLookNFeel/StaticText" nameSuffix="__text">...</Child>
If it doesn't start with "__auto_" the static_text is created as a child that is selectable in the LayoutEditor and is a "real" child-window of my button... Unfortunately the loading of layout fails with "GUILayout_xmlHandler::startElement - layout loading has been aborted since Window named 'Root/Button__text' already exists." which makes somehow sense in that way...
If I add the "__auto_" (as seen in the other .looknfeel-files) the child is not created at all....
My simple-text-button:
Code: Select all
<WidgetLook name="MyLookNFeel/Button">
<Child type="MyLookNFeel/StaticText" nameSuffix="__auto_text">
<Area>
<Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="RightEdge"><UnifiedDim scale="1" offset="0" type="RightEdge" /></Dim>
<Dim type="BottomEdge"><UnifiedDim scale="1" offset="0" type="BottomEdge" /></Dim>
</Area>
<Property name="AlwaysOnTop" value="true" />
<Property name="BackgroundEnabled" value="false" />
</Child>
<StateImagery name="Normal" />
<StateImagery name="Hover" />
</WidgetLook>
any ideas?
thanks
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: StaticText as child of PushButton
What we will call the implicit requirement for those child windows to use the '__auto_' convention is totally wrong. We should use another technique to detect whether a window comes via the looknfeel.
With regards to the window not being created when using an '__auto_' based name, is this in the app code, the CELayoutEditor or both? Very strange. One I know where I can look into this, I will
CE.
With regards to the window not being created when using an '__auto_' based name, is this in the app code, the CELayoutEditor or both? Very strange. One I know where I can look into this, I will
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: StaticText as child of PushButton
It happens both - in the CELayoutEditor and my app...
thanks much, it would be really great to use that!
rob
thanks much, it would be really great to use that!
rob
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: StaticText as child of PushButton
Thanks for confirming it happens 'always'. I'll test it out and get back to you in a day or two...
CE
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: StaticText as child of PushButton
CrazyEddie wrote:I'll test it out and get back to you in a day or two...
Or a week
I did test this, using TaharezLook parts and it seems to work ok for me; I was able to successfully have a TaharezLook/StaticText as a child specified in the looknfeel with name suffix "__auto_static" and it gets created ok.
I can't think of anything that could cause this issue, except if it bails out part way through constructing the object - presumably there are no errors in the log and/or no exceptions being thrown?
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: StaticText as child of PushButton
Hi CE,
thanks for the testing - I finally came back on that topic and the statictext gets created fine with its name set to "__auto_static" BUT I can't see/access/edit its text.
I spend some time with the propertylinkdefinition-stuff but gotten nowhere. Am I right, that I have to link the text-property of my __auto_static-widget to my button to use it?
I tried <PropertyLinkDefinition name="Text" widget="__auto_static" initialValue="" layoutOnWrite="true" /> and some more varianties but then I get the "already exist"-error I had before (btw, it was actually not caused by the child-definition) .
So how can I use the text of the staticText-child properly?
Thanks much
rob
thanks for the testing - I finally came back on that topic and the statictext gets created fine with its name set to "__auto_static" BUT I can't see/access/edit its text.
I spend some time with the propertylinkdefinition-stuff but gotten nowhere. Am I right, that I have to link the text-property of my __auto_static-widget to my button to use it?
I tried <PropertyLinkDefinition name="Text" widget="__auto_static" initialValue="" layoutOnWrite="true" /> and some more varianties but then I get the "already exist"-error I had before (btw, it was actually not caused by the child-definition) .
So how can I use the text of the staticText-child properly?
Thanks much
rob
Re: StaticText as child of PushButton
I'm getting closer... I finally realized that all my problems where caused by redefining the "Text"-property (of my button) that should link to the "Text"-property of the StaticText-child...
I think I can't replace/overwrite existing properties?
thanks
rob
I think I can't replace/overwrite existing properties?
thanks
rob
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: StaticText as child of PushButton
Yeah you can't replace / shadow an existing property with a PropertyDefinition or PropertyLinkDefinition. You can add a new one though, for example 'Label' or something, you also need to specify the name of the property on the target:
HTH
CE
Code: Select all
<PropertyLinkDefinition name="Label" widget="__auto_static" targetProperty="Text" initialValue="" layoutOnWrite="true" />
HTH
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 4 guests