SdkTray TextBox not showing text nor caption

Problems building or running the engine, queries about how to use features etc.
Post Reply
Cheaterman
Gnoblar
Posts: 8
Joined: Fri Feb 25, 2011 10:20 pm

SdkTray TextBox not showing text nor caption

Post by Cheaterman »

Hi,

I'm simply using the Advanced Ogre Framework demo code (see http://www.spacegaier.de/Ogre/AdvancedOgreFramework.rar - GameState.cpp, lines 353 to 356, copypasted below: )

Code: Select all

    Ogre::String infoText = "[TAB] - Switch input mode\n\n[W] - Forward / Mode up\n[S] - Backwards/ Mode down\n[A] - Left\n";
    infoText.append("[D] - Right\n\nPress [SHIFT] to move faster\n\n[O] - Toggle FPS / logo\n");
    infoText.append("[Print] - Take screenshot\n\n[ESC] - Exit");
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createTextBox(OgreBites::TL_RIGHT, "InfoPanel", infoText, 300, 220);
Which in my case (since after trying to solve it I noticed the above code is passing a HUGE caption argument to the TextBox without giving it any actual text) translates to:

Code: Select all

    Ogre::DisplayString title = "Help";
    Ogre::DisplayString helpText = "Welcome player, here is the help:\n\n";
    helpText.append("Blah blah blah\n\n");
    helpText.append("More help\n\n");
    helpText.append("\n\nYou kinda got it");
    OgreBites::TextBox* helpBox = OgreFramework::getSingletonPtr()->m_pTrayMgr->createTextBox(OgreBites::TL_RIGHT, "HelpBox", title, 200, 150);
    helpBox->setText(helpText);
    helpBox->setPadding(0);
The result is first that my TextBox doesn't show any text (no title either) until I either scroll (which shows only text) or toggle FrameStats (shows both text and caption), and second that the refreshed TextBox has a very weird text alignment - much like if for some reason there were lots of padding on the right, which is why I (tried to) remove padding, but it didn't fix anything.

Thanks in advance
Last edited by Cheaterman on Wed May 18, 2011 12:24 am, edited 1 time in total.
Cheaterman
Gnoblar
Posts: 8
Joined: Fri Feb 25, 2011 10:20 pm

Re: SdkTray TextBox not showing text nor caption

Post by Cheaterman »

Bumped, as I didn't work this out so far (spent 4 hours on this today). I will do my best tomorrow to find out where the problem comes from, but as I'm not familiar to Ogre overlays yet I didn't dig too much into SdkTrays.h itself - especially since I'm probably doing it wrong somewhere anyway.

Here are a few screenshots:

Image
(initial state)

Image
(used "o" - triggered TrayMgr->hideFrameStats();)

Image
(clicked the scrolling button and moved the mouse of at least 1px)

Thanks in advance to anyone trying to help me.
Cheaterman
Gnoblar
Posts: 8
Joined: Fri Feb 25, 2011 10:20 pm

Re: SdkTray TextBox not showing text nor caption

Post by Cheaterman »

Please, don't hesitate to tell me if any information you need to troubleshoot this is missing. You could also point me to some documentation, since the doc I'm using (http://www.ogre3d.org/tikiwiki/SdkTrays) might be incomplete for some reason.

Also note that I've been trying to adjustTrays() and many other fixes suggested on this forum, to no avail.
Cheaterman
Gnoblar
Posts: 8
Joined: Fri Feb 25, 2011 10:20 pm

Re: SdkTray TextBox not showing text nor caption

Post by Cheaterman »

Tagada pwet pwet, I'd really like to get some help here, since I've been able to fix all the other problems I was experiencing with AOF except this one...
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: SdkTray TextBox not showing text nor caption

Post by jacmoe »

That's not more to do but flip visibility (IIRC) - it's a bug, and it looks like it's not going to be fixed anytime soon, if ever.
Sadly.
That said, I haven't filed a bug or sent in a patch either - so I shouldn't complain. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Cheaterman
Gnoblar
Posts: 8
Joined: Fri Feb 25, 2011 10:20 pm

Re: SdkTray TextBox not showing text nor caption

Post by Cheaterman »

First, thank you very much for your answer!

But I actually don't know how to flip tray visibility, could you tell me how to do so please?
andrewc
Gnoblar
Posts: 5
Joined: Tue Aug 18, 2015 11:18 am
x 1

Re: SdkTray TextBox not showing text nor caption

Post by andrewc »

In case anybody else is stuck on this four years later: I've just had the same problem with wrapped text in a TextBox only using about half the available width. I tracked this down to the fact that Ogre::Font::getGlyphAspectRatio was returning 1.0 for every glyph in the font I was using, and solved it by forcing an immediate load of the font well in advance of creating the widget, using the following code:

Code: Select all

	Ogre::FontManager& fm = Ogre::FontManager::getSingleton();
	Ogre::FontPtr valueFontPtr = fm.getByName("SdkTrays/Value");
	if (!valueFontPtr.isNull()) {
		valueFontPtr.getPointer()->load();
	}
Andrew
Post Reply