Page 1 of 1

PushButton::setStandardImageryEnabled

Posted: Mon Oct 15, 2007 01:10
by tgraupmann
What did PushButton::setStandardImageryEnabled from CEGUI 4 convert to in CEGUI 5?

Posted: Fri Oct 19, 2007 02:26
by tgraupmann
I just need to know what SetProperty should I use:
http://www.cegui.org.uk/wiki/index.php/SetProperty

Since there's nothing like the old method that I can see?

Posted: Sun Oct 28, 2007 09:02
by CrazyEddie
IIRC a replacement provision for this was not enabled in the skins provided with 0.5.x code; I guess at the time the idea was that people could basically knock up a simple button skin to do whatever they needed, so this particular ability was omitted.

If you need that specific behaviour, it can be emulated by modifying the skin. The <Section> element, which is used within <Layer> elements which appear in the various <StateImagery> specifications, has an attribute called 'controlProperty' - this can be used to specify the name of a boolean property (which should be added to the widget via a <PropertyDefinition>) that controls whether the section imagery will be rendered.

Basically you add a property named "StandardImageryEnabled" and use the 'controlPropery' feature described above to decide whether to render certain imagery.

Somewhere at the top of the LookNFeel for a button...

Code: Select all

...
<PropertyDefinition name="StandardImageryEnabled" initialValue="True" redrawOnWrite="true" />
...


Later on in the StateImagery bits...

Code: Select all

...
<StateImagery name="Normal">
    <Layer>
        <Section section="normal" controlProperty="StandardImageryEnabled" />
        <Section section="label">
            <ColourProperty name="NormalTextColour" />
        <Section>
    </Layer>
</StateImagery>
<StateImagery name="Hover">
    <Layer>
        <Section section="hover" controlProperty="StandardImageryEnabled" />
        <Section section="label">
            <ColourProperty name="HoverTextColour" />
        </Section>
    </Layer>
</StateImagery>
...

Posted: Sun Oct 28, 2007 11:38
by scriptkid
Guess who's back ;)

Posted: Sun Oct 28, 2007 18:57
by tgraupmann
Thanks for the tip. I feared I would never see an answer to this post. This is exactly what I was looking for.