How to let the backgroud of MultiLineEditbox transparency?

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

pyhmail
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Thu Apr 03, 2008 02:37

How to let the backgroud of MultiLineEditbox transparency?

Postby pyhmail » Wed May 28, 2008 07:36

I create a MultiLineEditbox window,and set its text (the text is "ABC"),now I want the show of the text is normal,but the backgroud of MultiLineEditbox window is translucency,can you tell me the way?

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

Postby CrazyEddie » Wed May 28, 2008 13:37

You can do it by adding a colour specification in the looknfeel file.

For example in TaharezLook.looknfeel, at around line 3071, you see this:

Code: Select all

<StateImagery name="Enabled">
    <Layer>
        <Section section="main" />
    </Layer>
</StateImagery>


If you change it to:

Code: Select all

<StateImagery name="Enabled">
    <Layer>
        <Section section="main">
            <Colours topLeft="7FFFFFFF" topRight="7FFFFFFF" bottomLeft="7FFFFFFF" bottomRight="7FFFFFFF" />
        </Section>
    </Layer>
</StateImagery>

It will make the main imagery 50% transparent for the Enabled state.

Alternatively, you could define a property at the top of the WidgetLook, so around line 2935 where you see

Code: Select all

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

add:

Code: Select all

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

Then use this property instead of the specific value shown above, so again at around line 3071, you would have this instead:

Code: Select all

<StateImagery name="Enabled">
    <Layer>
        <Section section="main">
            <ColourProperty name="MainColour" />
        </Section>
    </Layer>
</StateImagery>

You can then write to the property "MainColour" in code or your layouts to change the colour / alpha of the imagery. For example:

Code: Select all

...
myEditbox->setProperty( "MainColour", "3FFFFFFF" );
...

Would give you about 25% on the alpha channel.

HTH

CE.

pyhmail
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Thu Apr 03, 2008 02:37

Thank CrazyEddie

Postby pyhmail » Thu May 29, 2008 01:13

CrazyEddie,thanks!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests