I want to display a window onto which I will display some text. I should only specify the width and coordinates. The height should automatically be scaled to match the height of the text.
I do not know what will be the text of the window in advance.
How do I do this?
Dynamic window
Moderators: CEGUI MVP, CEGUI Team
I'm not quite sure of the effect you're after, and what you've tried.
You might turn off the background:
CEGUI::StaticText* pStaticText = (CEGUI::StaticText*)GetWindowManager().getWindow( "blah_name" );
pStaticText->setBackgroundEnabled( false );
Assuming you have some function which allows you to set the string, you could do your resizing/scaling of the parent window in there...
Hope this helps a bit...
You might turn off the background:
CEGUI::StaticText* pStaticText = (CEGUI::StaticText*)GetWindowManager().getWindow( "blah_name" );
pStaticText->setBackgroundEnabled( false );
Assuming you have some function which allows you to set the string, you could do your resizing/scaling of the parent window in there...
Hope this helps a bit...
Rakkar,
You have to compute this. If the WIDTH is set, then it makes it much easier. First, you need to get the FONT (CEGUI::Font) so you can use it to determine the max width in chars. There are several helper functions in the CEGUI::Font that will help you determine width and heigth. It will give you the width for a given text and will tell you the "height" for a line of text. The part you have to do is figure out how many lines there will be.What makes it even tricker is if the lines could contain some '\n'(CR and/or LF).
I wrote a dialog class which uses a CEGUI::DefaultWindow (StaticText) inside a FrameWindow. What I do is adjust the height/width of the frame window.
You have to compute this. If the WIDTH is set, then it makes it much easier. First, you need to get the FONT (CEGUI::Font) so you can use it to determine the max width in chars. There are several helper functions in the CEGUI::Font that will help you determine width and heigth. It will give you the width for a given text and will tell you the "height" for a line of text. The part you have to do is figure out how many lines there will be.What makes it even tricker is if the lines could contain some '\n'(CR and/or LF).
I wrote a dialog class which uses a CEGUI::DefaultWindow (StaticText) inside a FrameWindow. What I do is adjust the height/width of the frame window.
Who is online
Users browsing this forum: No registered users and 13 guests