2 questios: transparent container and text colors

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

User avatar
rogerdv
Quite a regular
Quite a regular
Posts: 62
Joined: Thu Mar 31, 2005 23:21
Contact:

2 questios: transparent container and text colors

Postby rogerdv » Wed Nov 21, 2007 22:29

I have 2 questions. I havent found the property name to set an static text color from the layout file. I have tried TextColour and TextColor, but doesnt works, log reports that such property it doesnt exists.
The second one is a bit harder. I have a frame window containing 10 buttons and one listbox I would like to make the container frame transparent, or almost transparent, without affecting the buttons, and also the listbox frame but without affecting the items. Is that possible?

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

Postby CrazyEddie » Thu Nov 22, 2007 09:32

Hi,

The property for the text colours is "TextColours" and the value format is "tl:aarrggbb tr:aarrggbb bl:aarrggbb br:aarrggbb" so for example, for green...

Code: Select all

<Property Name="TextColours" Value="tl:FF00FF00 tr:FF00FF00 bl:FF00FF00 br:FF00FF00" />


To have a parent window transparent or semi-transparent but not affect the child windows, simply set the "InheritsAlpha" property on the child windows to false - this allows you to set the alpha of the parent and children independently.

Depending if you're using the old or newer style listbox the above may have no effect, since the old style listbox did not use child windows for the content. In this case you need to adjust the LookNFeel for the Listbox so that the imagery is rendered with an appropriate alpha value (which will not affect the alpha of the items).

One way you could approach this is, within the WidgetLook definition for the old style Listbox, to define a property to control the frame colours

Code: Select all

<PropertyDefinition name="ListFrameColour" initialValue="FFFFFFFF" redrawOnWrite="true" />


and then apply this property to the rendering of the frame ImagerySection (example is modified from WindowsLook/Listbox):

Code: Select all

<ImagerySection name="main">
    <FrameComponent>
        <Area>
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
        </Area>
        <Image type="TopLeftCorner" imageset="WindowsLook" image="StaticFrameTopLeft" />
        <Image type="TopRightCorner" imageset="WindowsLook" image="StaticFrameTopRight" />
        <Image type="BottomLeftCorner" imageset="WindowsLook" image="StaticFrameBottomLeft" />
        <Image type="BottomRightCorner" imageset="WindowsLook" image="StaticFrameBottomRight" />
        <Image type="LeftEdge" imageset="WindowsLook" image="StaticFrameLeft" />
        <Image type="RightEdge" imageset="WindowsLook" image="StaticFrameRight" />
        <Image type="TopEdge" imageset="WindowsLook" image="StaticFrameTop" />
        <Image type="BottomEdge" imageset="WindowsLook" image="StaticFrameBottom" />
        <Image type="Background" imageset="WindowsLook" image="Background" />

        <!-- Set a property to control the colours applied to this imagery section only -->
        <ColourProperty name="ListFrameColour>

    </FrameComponent>
</ImagerySection>


Then by setting the newly defined property you can affect just the frame alpha and/or colours, but not the children (or items for the old style lists).

Probably the best approach is the InheritsAlpha solution, since it was designed for this purpose - though the LookNFeel based solution saves you from setting the InheritsAlpha property on every child, and could afford some more advanced possibilities too :)

HTH

CE


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests