Game Development Community

Quick Fix to GuiTreeViewCtrl

by Kevin Rogers · in Torque Game Engine · 03/25/2005 (5:41 pm) · 0 replies

While making some tweaks to the GUI editor, I noticed that if I changed the font and increased the font size for the GuiEditorTreeView control, it would cut the text off. For some reason, the cell height was being hardcoded to 11 instead of checking the font height. Here's the fix below.

Old code:
bool GuiTreeViewCtrl::onWake()
{
   if (! Parent::onWake())
      return false;
   
   //get the font
   mFont = mProfile->mFont;
   
   //init the size
   [b]mCellSize.set( 640, 11 );[/b]
   return(true);
}

Change to:
bool GuiTreeViewCtrl::onWake()
{
   if (! Parent::onWake())
      return false;
   
   //get the font
   mFont = mProfile->mFont;
   
   //init the size
   [b]mCellSize.set( 640, mFont->getHeight() );[/b]
   return(true);
}

So simple that I'm astonished that this wasn't done initially... =)