Game Development Community

GuiTabBookCtrl and guiTabPageCtrl Help

by Shon Gale · in Torque Game Engine · 03/05/2008 (6:45 am) · 3 replies

Does anyone have a working example of these control(s) in action? Does this control operate standalone or does it need a guiWindow or other container in order to work? I cannot find any docs on this anywhere except for TGB and that is not relevant. I appreciate any help on this as a Tab Control in the gui would make life simpler.

#1
03/05/2008 (9:04 am)
GuiTabBookCtrl
...GuiTabPageCtrl
...GuiTabPageCtrl
each of the GuiTabPageCtrl can have child controls. If I remember correctly, GuiTabBookCtrl can ONLY have children of type GuiTabPageCtrl.


Some of my notes on the thing:

================
GuiTabBookCtrl Bitmap array

Selected: 0) left 1) adjustable center 2) right
NotSelected: 3) left 4) adjustable center 5) right
hover over: 6) left 7) adjustable center 8) right
who knows?: 9) left 10) adjustable center 11) right
who knows?: 12) left 13) adjustable center 14) right
who knows?: 15) left 16) adjustable center 17) right
18) ??? 19) ??? 20) unused tab area
21) upper right corner of border 22) middle of left side of border 23) center fill
24) right middle side border 25) left bottom of border 26) middle of bottom of border
27) right bottom of border


It seems like element 20) starts a common set of 8 bitmaps for a "skinnable" window or a scrollbar or something.

The "who knows?" elements from 9..17 may be for vertical tabs.

================
www.garagegames.com/products/torque/tgb/features/111changelist/
Talks about:
TGB 1.1.1 Aug 9, 2006
Fixed Rendering Issue in TabBook.

Is this fixed in TGE??

=================

PSD formats for gui controls
tdn.garagegames.com/wiki/GUI/Lessons/Complete_Change
#2
03/05/2008 (9:08 am)
This is my least favorite control.

I made changes to:
1. allow tab pages to be turned off

void GuiTabBookCtrl::renderTabs( const Point2I &offset )
{
   // If the tab size is zero, don't render tabs,
   //  and assume it's a tab-less tab-book - JDD
   if( mPages.empty() || mTabHeight <= 0 )
      return;

   for( S32 i = 0; i < mPages.size(); i++ )
   {
      RectI tabBounds = mPages[i].TabRect;
      tabBounds.point += offset;
      GuiTabPageCtrl *tab = mPages[i].Page;
      if( tab != NULL 
         && tab->isActive()) { // MVJ addition: allow tabs to be turned off NOTE: probably a better way: by removing them from Book simgroup
         renderTab( tabBounds, tab );
      }
   }
}

2. Don't allow selecting inactive pages

void GuiTabBookCtrl::selectPage( GuiTabPageCtrl *page )
{
   if (page && !page->isActive()) { return; }; // MVJ addition: don't allow selecting inactive pages

   Vector<TabHeaderInfo>::iterator i = mPages.begin();
   for( ; i != mPages.end() ; i++ )
   {
      GuiTabPageCtrl *tab = reinterpret_cast<GuiTabPageCtrl*>((*i).Page);
      if( page == tab )
      {
         mActivePage = tab;
         tab->setVisible( true );

         // Notify User
         char *retBuffer = Con::getReturnBuffer( 512 );
         dStrcpy( retBuffer, tab->getText() );
         Con::executef( this, 2, "onTabSelected",  retBuffer );

      }
      else
         tab->setVisible( false );
   }
}

Consider these mods at your own risk. This control is still so iffy that I haven't deployed any use of it yet other than the magically working options dialog.
#3
03/07/2008 (7:18 am)
@Matthew: Thanks for the response and the input on this control. I looked over the code in the OptionsDlg.gui and .cs files and love the work in there. But the versions I looked at (TGE, TGEA) and could find no reference to guiTabBook or guiTabPageCtrl. I have been using the same system they use (Panes) and that works great. I was mainly trying out all the controls I haven't used and trying to see how to implement them. Another control I haven't been successful with is the guiBubbleTextCtrl. There seems to be controls for the gui that are not finished and don't seem to work.
Plus thanks for the links. I never ran across those in my travels. Very interesting.