Page 1 of 1

BackgroundEnabled and FrameEnabled not honored

Posted: Sun Dec 02, 2007 18:22
by tgraupmann
I have a button that keeps showing the frame even though I've disabled it. Here is the layout and relevant XML:

Code: Select all

      <Window Type="TaharezLook/StaticImage" Name="MainMenuTitle">
         <Property Name="BackgroundEnabled" Value="False" />
         <Property Name="FrameEnabled" Value="False" />
         <Window Type="TaharezLook/Button" Name="MainMenuTraining">
            <Property Name="BackgroundEnabled" Value="False" />
            <Property Name="FrameEnabled" Value="False" />
            </Window>


Is there another way to disable the frame for a button?

Posted: Mon Dec 03, 2007 02:45
by tgraupmann
These two properties don't appear to be in the Property Set. How would I add them to the set so that I can disable the background and frame?

Posted: Mon Dec 03, 2007 02:50
by tgraupmann
I added the following to TaharezLook.looknfeel:

Code: Select all

<Falagard>
    <!--
    ***************************************************
        TaharezLook/Button
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/Button">
        <PropertyDefinition name="FrameEnabled" initialValue="True" redrawOnWrite="true" />
        <PropertyDefinition name="BackgroundEnabled" initialValue="True" redrawOnWrite="true" />


The properties can be get and set.

Still when I set to false, the background and frame are still being displayed.

What else must I do?

Posted: Mon Dec 03, 2007 03:11
by tgraupmann
Ah nevermind, I just switched to using an:
TaharezLook/ImageButton

Posted: Mon Dec 03, 2007 11:11
by scriptkid
Hi,

glad you found it :) About the PropertyDefinitions not working: that's because BackgroundEnabled and FrameEnabled are 'internal' properties, which the StaticImage renderer (inside cegui) defined/expects at code level. User defined properties are mainly used for additional (not widget specific) customizations such as colour overlays or images inside an Area for example. As you can see here, the StaticImage has these properties defined on widget level (the yellow ones):

http://www.cegui.org.uk/wiki/index.php/ ... taticImage

"Button" hasn't. Adding those properties to Buttons would require a code change.

HTH.

Posted: Mon Dec 03, 2007 11:33
by CrazyEddie
tgraupmann wrote:I added the following to TaharezLook.looknfeel:

Code: Select all

<Falagard>
    <!--
    ***************************************************
        TaharezLook/Button
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/Button">
        <PropertyDefinition name="FrameEnabled" initialValue="True" redrawOnWrite="true" />
        <PropertyDefinition name="BackgroundEnabled" initialValue="True" redrawOnWrite="true" />


The properties can be get and set.

Still when I set to false, the background and frame are still being displayed.

What else must I do?


Although Scriptkid's reply is totally correct, it is possible to largely emulate the behavior within a look and feel xml file (maybe this is how we did it with ImageButton, I can't recall :-?). Basically you define the properties as you did and then use the "controlProperty" attribute in the <Section> elements to link the defined properties to the sections of imagery. When the property is true the section is rendered, and when the property is false the section is not rendered.

HTH

CE.