How to put text in ImageButton without using statictext ?[SO

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

TeddyBear94
Just popping in
Just popping in
Posts: 9
Joined: Tue Sep 20, 2011 08:59

How to put text in ImageButton without using statictext ?[SO

Postby TeddyBear94 » Tue Sep 20, 2011 09:17

Hi everybody,

Do you know if is that possible to change ImageButton section in looknfeel file (from taharezlook) to be able to use "Text" property for this widget in layout file ?
I just tried to put a text component in ImageButton section in looknfeel file but it does not work (see below what I added to defaut taharezlook looknfeel file)...

Code: Select all

     ***************************************************
        TaharezLook/ImageButton
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/ImageButton">
        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
        <PropertyDefinition name="NormalImage" initialValue="imgBtnNormal" redrawOnWrite="true" />
        <PropertyDefinition name="HoverImage" initialValue="imgBtnHoverl" redrawOnWrite="true" />
        <PropertyDefinition name="PushedImage" initialValue="imgBtnPushed" redrawOnWrite="true" />
        <PropertyDefinition name="DisabledImage" initialValue="imgBtnDisabled" redrawOnWrite="true" />
        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
       <ImagerySection name="label">
            <TextComponent>
                <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>
                <VertFormatProperty name="VertLabelFormatting" />
                <HorzFormatProperty name="HorzLabelFormatting" />
            </TextComponent>
        </ImagerySection>
      <ImagerySection name="normal">
            <ImageryComponent>
                <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>
                <ImageProperty name="NormalImage" />
                <VertFormatProperty name="VertImageFormatting" />
                <HorzFormatProperty name="HorzImageFormatting" />
            </ImageryComponent>
        </ImagerySection>
        <ImagerySection name="hover">
            <ImageryComponent>
                <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>
                <ImageProperty name="HoverImage" />
                <VertFormatProperty name="VertImageFormatting" />
                <HorzFormatProperty name="HorzImageFormatting" />
            </ImageryComponent>
        </ImagerySection>
        <ImagerySection name="pushed">
            <ImageryComponent>
                <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>
                <ImageProperty name="PushedImage" />
                <VertFormatProperty name="VertImageFormatting" />
                <HorzFormatProperty name="HorzImageFormatting" />
            </ImageryComponent>
        </ImagerySection>
        <ImagerySection name="disabled">
            <ImageryComponent>
                <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>
                <ImageProperty name="DisabledImage" />
                <VertFormatProperty name="VertImageFormatting" />
                <HorzFormatProperty name="HorzImageFormatting" />
            </ImageryComponent>
        </ImagerySection>
        <StateImagery name="Normal">
            <Layer>
                <Section section="normal" />
            </Layer>
        </StateImagery>
        <StateImagery name="Hover">
            <Layer>
                <Section section="hover" />
            </Layer>
        </StateImagery>
        <StateImagery name="Pushed">
            <Layer>
                <Section section="pushed" />
            </Layer>
        </StateImagery>
        <StateImagery name="PushedOff">
            <Layer>
                <Section section="hover" />
            </Layer>
        </StateImagery>
        <StateImagery name="Disabled">
            <Layer>
                <Section section="disabled" />
            </Layer>
        </StateImagery>
    </WidgetLook>


I guess something is missing because my text is not displayed :) but I do not find what...

Thanks for your help.
Last edited by TeddyBear94 on Thu Sep 29, 2011 15:14, edited 2 times in total.

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

Re: How to put text in ImageButton without using statictext

Postby CrazyEddie » Tue Sep 20, 2011 09:27

Hi,

You just have to mention the new ImagerySection where the imagery to use for the various states is defined, for example:

Code: Select all

        <StateImagery name="Normal">
            <Layer>
                <Section section="normal" />
                <Section section="label" />
            </Layer>
        </StateImagery>


Repeat that for the other states, and all should be well.

HTH

CE.

TeddyBear94
Just popping in
Just popping in
Posts: 9
Joined: Tue Sep 20, 2011 08:59

Re: How to put text in ImageButton without using statictext

Postby TeddyBear94 » Tue Sep 20, 2011 09:30

Nice !

I will try that this evening.

Thanks a lot.

Teddy.

TeddyBear94
Just popping in
Just popping in
Posts: 9
Joined: Tue Sep 20, 2011 08:59

Re: How to put text in ImageButton without using statictext

Postby TeddyBear94 » Wed Sep 21, 2011 09:32

Tested yesterday, it works ==> Resolved.

Thanks Eddie.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests