Page 1 of 1

How to let the backgroud of MultiLineEditbox transparency?

Posted: Wed May 28, 2008 07:36
by pyhmail
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?

Posted: Wed May 28, 2008 13:37
by CrazyEddie
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.

Thank CrazyEddie

Posted: Thu May 29, 2008 01:13
by pyhmail
CrazyEddie,thanks!