Page 1 of 1

[Solved] Change background bolour of an Image

Posted: Sat Mar 07, 2009 13:39
by Lastmerlin
I tried to change the colour of the background for a Image:

Code: Select all

label->setProperty("BackgroundEnabled", "true");
label->setProperty("BackgroundColours", "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000");


Well it didnt work ^^

Search says I am not the first one who has this problem:
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3473&highlight=background+color+colour
... but I cant see if the problem was solved there and what the solutions is

I tried to replace

Code: Select all

 <StateImagery name="WithFrameEnabledBackground">
            <Layer>
                <Section look="TaharezLook/StaticShared" section="background" />
            </Layer>
        </StateImagery>


by this:

Code: Select all

<StateImagery name="WithFrameDisabledBackground">
     <Layer>
         <Section look="TaharezLook/StaticShared" section="background" />
             < ColourRectProperty name="BackgroundColours" />
         </Section>
     </Layer>
 </StateImagery>


with the result of getting this error:

Code: Select all

terminate called after throwing an instance of 'CEGUI::FileIOException'


I noticed that there are such commented lines in the looknfeel:
<!--<ColourRectProperty name="BackgroundColours" />-->

... but uncommenting results in the same error.

Posted: Sat Mar 07, 2009 14:56
by CrazyEddie
Hi,

No change has currently been made in response to the other thread :?

In order to get a configurable background colour in the static widgets, you need to do something like this (beware of line wraps):

Code: Select all

Index: Samples/datafiles/looknfeel/TaharezLook.looknfeel
===================================================================
--- Samples/datafiles/looknfeel/TaharezLook.looknfeel   (revision 1976)
+++ Samples/datafiles/looknfeel/TaharezLook.looknfeel   (working copy)
@@ -2271,9 +2271,8 @@
                         </UnifiedDim>
                     </Dim>
                 </Area>
-                <Image imageset="TaharezLook" image="StaticBackdrop" />
-                <!--<ColourRectProperty name="BackgroundColours" />-->
-                <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                <Image imageset="TaharezLook" image="MultiLineEditboxSelectionBrush" />
+                <ColourRectProperty name="BackgroundColours" />
                 <VertFormat type="Stretched" />
                 <HorzFormat type="Stretched" />
             </ImageryComponent>
@@ -2286,9 +2285,8 @@
                     <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
                     <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
                 </Area>
-                <Image imageset="TaharezLook" image="StaticBackdrop" />
-                <!--<ColourRectProperty name="BackgroundColours" />-->
-                <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                <Image imageset="TaharezLook" image="MultiLineEditboxSelectionBrush" />
+                <ColourRectProperty name="BackgroundColours" />
                 <VertFormat type="Stretched" />
                 <HorzFormat type="Stretched" />
             </ImageryComponent>
@@ -2303,7 +2301,7 @@
     <WidgetLook name="TaharezLook/StaticImage">
                <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
                <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
-               <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+               <PropertyDefinition name="BackgroundColours" initialValue="tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" redrawOnWrite="true" />
         <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" />
         <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" />
         <Property name="BackgroundEnabled" value="True" />
@@ -2399,7 +2397,7 @@
     -->
     <WidgetLook name="TaharezLook/StaticText">
                <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
-               <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+               <PropertyDefinition name="BackgroundColours" initialValue="tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" redrawOnWrite="true" />
         <Property name="FrameEnabled" value="True" />
         <Property name="BackgroundEnabled" value="True" />
         <NamedArea name="WithFrameTextRenderArea">


The reason we use "MultiLineEditboxSelectionBrush" is because it's about the only image in taharez look that will give satisfactory results with regards to colouring and stretching ;)

HTH

CE

Posted: Sun Mar 08, 2009 10:55
by Lastmerlin
It works, thanks a lot :)

You should consider to commit this change to the *official* taharezlook file.

Posted: Mon Mar 09, 2009 08:57
by CrazyEddie
I think perhaps for 0.7.0, time permitting, all the looknfeel definitions should have a once-over to resolve a couple of things and to enable 'obvious' missing features like this one.

CE.