I wanted to make a menu with only letters, something like this:
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
Menu fixed
Moderators: CEGUI MVP, CEGUI Team
Re: Menu fixed
Use a DefaultWindow and put static text widgets inside. React to EventMouseClicked. You could alternatively use Button widget and alter it's looknfeel.
Re: Menu fixed
Thanks
I'm using OgreTray, in looknfeel the Static Text is:
How can I remove the button image that is behind the Static Text?
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
Re: Menu fixed
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.
EDIT: I guess this could be the default setting for 0.8 for StaticText as most people seem to always disable the frame.
Re: Menu fixed
Thanks Kulik
And how to fix the framewindow nobody move around or change its size?
And how to fix the framewindow nobody move around or change its size?
Re: Menu fixed
setSizingEnabled and setDragMovingEnabled... But unless you really need something from FrameWindow, I would just use DefaultWindow... You will also have to disable rollup, etc..
Re: Menu fixed
To execute an action on the button I'm doing this:
And function CEGUI_PushButton_Exit:
I tried to execute the action PostQuitMessage(0) directly in CEGUI::Event::Subscriber but I could not, no way?
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?
Re: Menu fixed
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!
Re: Menu fixed
Sorry!
I tried only putting the function PostQuitMessage(0) in CEGUI::Event::Subscriber this way:
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
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
Re: Menu fixed
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!
Re: Menu fixed
That was my doubt, and was answered
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
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
Who is online
Users browsing this forum: No registered users and 11 guests