[Bug? & Fix] TabButton's and Parsed Text

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

Icewave
Just popping in
Just popping in
Posts: 17
Joined: Fri Mar 06, 2009 01:55

[Bug? & Fix] TabButton's and Parsed Text

Postby Icewave » Fri May 27, 2011 19:17

Hi All!

I was having some problems with tab buttons today:

using this as an example string:
"[image='set:Images image:Image']Test"

The Tab button would display the image and the text - however the size of the tab itself would be as long as the string in width

I managed to fix this via editing CEGUITabControl.cpp: TabControl::calculateTabButtonSizePosition on at line 529+ so that it reads:

Code: Select all

    // Width is based on font size (expressed as absolute)
   if(btn->isTextParsingEnabled())
   {
      btn->setWidth(cegui_absdim(btn->getRenderedString().getPixelSize(0).d_width) +
                     getTabTextPadding() + getTabTextPadding());
   }
   else
   {
      Font* fnt = btn->getFont();
      btn->setWidth(cegui_absdim(fnt->getTextExtent(btn->getText())) +
                     getTabTextPadding() + getTabTextPadding());
   }


Is this a viable solution? and is the If statement even necessary?

Hopefully i didn't just overlook some setting somewhere and am not making a total fool of myself right now :D

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

Re: [Bug? & Fix] TabButton's and Parsed Text

Postby Kulik » Fri May 27, 2011 20:09

Seems legit, thanks! I will try to look into this over the weekend.

http://www.cegui.org.uk/mantis/view.php?id=455


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 10 guests