Menu fixed

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

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Menu fixed

Postby VitaliBR » Mon Nov 01, 2010 13:35

I wanted to make a menu with only letters, something like this:

Image

I thought about creating a FrameWindow, and leave it with the 0.0 Alpha, and Alpha texts for 1.0f
But how do I turn the text to buttons?
And how to fix the framewindow nobody move around or change its size?

Thanks

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Menu fixed

Postby Kulik » Mon Nov 01, 2010 13:46

Use a DefaultWindow and put static text widgets inside. React to EventMouseClicked. You could alternatively use Button widget and alter it's looknfeel.

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Menu fixed

Postby VitaliBR » Mon Nov 01, 2010 14:24

Thanks

I'm using OgreTray, in looknfeel the Static Text is:

Code: Select all

<!--
:::: StaticText
-->
    <WidgetLook name="OgreTray/StaticText">
        <Property name="BackgroundEnabled" value="True" />
        <Property name="FrameEnabled" value="True" />
        <Property name="TextColours" value="tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" />
        <Property name="HorzFormatting" value="WordWrapLeftAligned" />
        <NamedArea name="WithFrameTextRenderArea">
            <Area>
                <Dim type="LeftEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxL" dimension="Width" />
                </Dim>
                <Dim type="TopEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxT" dimension="Height" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaHScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxL" dimension="Width" />
                </Dim>
                <Dim type="TopEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxT" dimension="Height" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Height" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaVScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxL" dimension="Width" />
                </Dim>
                <Dim type="TopEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxT" dimension="Height" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="WithFrameTextRenderAreaHVScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxL" dimension="Width" />
                </Dim>
                <Dim type="TopEdge" >
                    <ImageDim imageset="OgreTrayImages" image="TextBoxT" dimension="Height" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Height" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderArea">
            <Area>
                <Dim type="LeftEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="TopEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge" />
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge" />
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaHScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="TopEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge" />
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Height" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaVScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="TopEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge" />
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="NoFrameTextRenderAreaHVScroll">
            <Area>
                <Dim type="LeftEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="TopEdge" >
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1.0" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1.0" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Height" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <Child type="OgreTray/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="OgreTrayImages" image="TextBoxL" dimension="Width" /></Dim>
                <Dim type="TopEdge" >
                    <AbsoluteDim value="0">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height" />
                        </DimOperator>
                    </AbsoluteDim>
                </Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="Width">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width">
                                <DimOperator op="Add">
                                    <ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" />
                                </DimOperator>
                            </ImageDim>
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="Height" ><ImageDim imageset="OgreTrayImages" image="Handle" dimension="Height" /></Dim>
            </Area>
            <VertAlignment type="BottomAligned" />
            <Property name="NonClient" value="True" />
        </Child>
        <Child type="OgreTray/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
            <Area>
                <Dim type="LeftEdge" >
                    <AbsoluteDim value="0">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxR" dimension="Width" />
                        </DimOperator>
                    </AbsoluteDim>
                </Dim>
                <Dim type="TopEdge" ><ImageDim imageset="OgreTrayImages" image="TextBoxT" dimension="Height" /></Dim>
                <Dim type="Width" ><ImageDim imageset="OgreTrayImages" image="Handle" dimension="Width" /></Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="OgreTrayImages" image="TextBoxB" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
            <HorzAlignment type="RightAligned" />
            <Property name="NonClient" value="True" />
        </Child>
        <StateImagery name="Enabled" />
        <StateImagery name="Disabled" />
        <StateImagery name="EnabledFrame">
            <Layer><Section look="OgreTray/StaticShared" section="frame" /></Layer>
        </StateImagery>
        <StateImagery name="DisabledFrame">
            <Layer><Section look="OgreTray/StaticShared" section="frame" /></Layer>
        </StateImagery>
        <StateImagery name="WithFrameEnabledBackground">
            <Layer><Section look="OgreTray/StaticShared" section="with_frame_background" /></Layer>
        </StateImagery>
        <StateImagery name="WithFrameDisabledBackground">
            <Layer><Section look="OgreTray/StaticShared" section="with_frame_background" /></Layer>
        </StateImagery>
        <StateImagery name="NoFrameEnabledBackground">
            <Layer><Section look="OgreTray/StaticShared" section="no_frame_background" /></Layer>
        </StateImagery>
        <StateImagery name="NoFrameDisabledBackground">
            <Layer><Section look="OgreTray/StaticShared" section="no_frame_background" /></Layer>
        </StateImagery>
    </WidgetLook>


How can I remove the button image that is behind the Static Text?

Thanks

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Menu fixed

Postby Kulik » Mon Nov 01, 2010 14:27

via FrameEnabled property, set it to false on your instances of it.

EDIT: I guess this could be the default setting for 0.8 for StaticText as most people seem to always disable the frame.

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Menu fixed

Postby VitaliBR » Mon Nov 01, 2010 15:15

Thanks Kulik :)

And how to fix the framewindow nobody move around or change its size?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Menu fixed

Postby Kulik » Mon Nov 01, 2010 15:16

setSizingEnabled and setDragMovingEnabled... But unless you really need something from FrameWindow, I would just use DefaultWindow... You will also have to disable rollup, etc..

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Menu fixed

Postby VitaliBR » Mon Nov 01, 2010 18:10

To execute an action on the button I'm doing this:

Code: Select all

   CEGUI::PushButton* bt_exit = static_cast<CEGUI::PushButton*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("MainWindow/exit"));
   bt_exit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CEGUI_PushButton_Exit));



And function CEGUI_PushButton_Exit:

Code: Select all

bool CEGUI_PushButton_Exit(const CEGUI::EventArgs &e)
{
   PostQuitMessage(0); //Quit the Game :(
   return true;
}


I tried to execute the action PostQuitMessage(0) directly in CEGUI::Event::Subscriber but I could not, no way?

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Menu fixed

Postby Jamarr » Mon Nov 01, 2010 19:56

VitaliBR wrote:but I could not


This statement is useless without details. You need to explicitly state what you have already tried; eg did you verify that CEGUI_PushButton_Exit was called? I can only assume that you are not injecting any input. I have to assume this, because you did not state one way or another. Have you read the tutorials, specifically Injecting Inputs? Also, I would suggested reading this article before seeking help. It will help you help us to help you ;)
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Menu fixed

Postby VitaliBR » Mon Nov 01, 2010 20:44

Sorry!


I tried only putting the function PostQuitMessage(0) in CEGUI::Event::Subscriber this way:

Code: Select all

bt_exit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(PostQuitMessage(0)));



I read the article Injecting Inputs, but not found something that did not need to create a function to perform

I know it's wrong, i read the doxygen:
http://cegui.org.uk/api_reference/class ... cec3103b2e
But I can not find an alternative :(

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Menu fixed

Postby Jamarr » Mon Nov 01, 2010 21:10

VitaliBR wrote:I tried only putting the function PostQuitMessage(0) in CEGUI::Event::Subscriber this way:

Code: Select all

bt_exit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(PostQuitMessage(0)));


This will not work because the signature of PostQuitMessage does not match the signature required by CEGUI::Event::Subscriber. In otherwords, the subscribing function must match this signature: bool function(const CEGUI::EventArgs& args).

You should be fine using the snippet you posted above, eg:

VitalBR wrote:

Code: Select all

bool CEGUI_PushButton_Exit(const CEGUI::EventArgs &e)
{
   PostQuitMessage(0); //Quit the Game :(
   return true;
}



However, for this function to be called CEGUI has to know that the user has clicked on the appropriate button. The only way for CEGUi to determine if this button has been pressed, is if you call injectMousePosition / injectMouseButtonDown whenever you detect mouse input.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Menu fixed

Postby VitaliBR » Tue Nov 02, 2010 00:14

That was my doubt, and was answered
Jamarr wrote:This will not work because the signature of PostQuitMessage does not match the signature required by CEGUI::Event::Subscriber. In otherwords, the subscribing function must match this signature: bool function(const CEGUI::EventArgs& args).


As for the code that I showed, it works and the button is performing the action perfectly. My question was whether I need to create a function

Thanks :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 20 guests