Page 1 of 1

Can't change StaticText BackgroundColours

Posted: Thu Aug 07, 2008 09:59
by erwinxu
Hi there:

I can't change StaticText BackgroundColours, here are the scripts in my .xml file:

<Window Type="TaharezLook/StaticText" Name="can1.1">
<Property Name="FrameEnabled" Value="False" />
<Property Name="BackgroundEnabled" Value="True" />
<Property Name="UnifiedPosition" Value="{{0.0556,0},{0.0877,0}}" />
<Property Name="UnifiedSize" Value="{{0.8889,0},{0.0877,0}}" />
<Property Name="HorzFormatting" Value="LeftAligned" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="BackgroundColours" Value="tl:FFFF0000 tr:FFFF0000 bl:FFFF0000 br:FFFF0000"/>
<Property Name="Alpha" Value="0.5" />
</Window>

Here are the codes in my program :

guiWnd= WindowManager::getSingleton().getWindow("can1.1");
guiWnd->setProperty("Text", "Hello.");
guiWnd->setProperty("BackgroundColours", "tl:FFFF0000 tr:FFFF0000 bl:FFFF0000 br:FFFF0000");

The background colour of StaticText is still black. I have searched the forum, but I can't find any useful solution....

Thanks

Posted: Thu Aug 07, 2008 11:57
by CrazyEddie
Hi,

I think the problem here is that the imagery for the TaharezLook StaticText is black, and as such when the colours are applied nothing happens (because (0 * c) always results in 0 no matter the value of c).

You could change the looknfeel so that the image used for the StaticText backdrop brush is not black to start with (this actually comes from "TaharezLook/StaticShared", and so a change would also affect StaticImage).

CE.

Background colour of StaticText

Posted: Fri Aug 08, 2008 05:51
by erwinxu
Hi Eddie:

Thanks for your reply, do you mean this (Frame disabled)? :

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

1, I can't find "WithFrameDisabledBackground" in TaharezLook.imageset. I have no idea to which image it links.
2, If I change the colour of StaticBackdrop (in TaharezLook.tga), for example, to pure white, the background would be white;
3, If I erase the StaticBackdrop block, it would be transparent, I still can't change the colour.
4, Another question about Listbox, can I change the height of a ListBox item ?

I use CEGUI in OGRE 1.4.9, thanks a lot.

Posted: Fri Aug 08, 2008 12:16
by CrazyEddie
On closer inspection we have not got this wired together properly in the looknfeel :oops:

What you need is something like this for example (TaharezLook.looknfeel, around line: 2576)

Code: Select all

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


This would be in combination with changing the brush image used. For example (TaharezLook.looknfeel, around line: 2274)

Code: Select all

<Image imageset="TaharezLook" image="MultiLineEditboxSelectionBrush" />


CE.