[Solved] Change background bolour of an Image

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Lastmerlin
Not too shy to talk
Not too shy to talk
Posts: 33
Joined: Sat Mar 08, 2008 17:25

[Solved] Change background bolour of an Image

Postby Lastmerlin » Sat Mar 07, 2009 13:39

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.
Last edited by Lastmerlin on Sun Mar 08, 2009 10:53, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Mar 07, 2009 14:56

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

Lastmerlin
Not too shy to talk
Not too shy to talk
Posts: 33
Joined: Sat Mar 08, 2008 17:25

Postby Lastmerlin » Sun Mar 08, 2009 10:55

It works, thanks a lot :)

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

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Mar 09, 2009 08:57

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.


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 21 guests