Page 1 of 1

Nested TabControls Cause Tab Index trouble

Posted: Wed Mar 16, 2005 07:09
by pjcast
I have a tabcontrol that has child defaultguisheets & two child tabcontrols (Nested tabs)..

And my handler for reacting to tab changes:

Code: Select all

      const CEGUI::WindowEventArgs&  we = static_cast<const CEGUI::WindowEventArgs&>(args);
      CEGUI::TabControl* tc = static_cast<CEGUI::TabControl*>(we.window);
      uint i = tc->getSelectedTabIndex();
      String newWindow = tc->getTabContentsAtIndex(i)->getName().c_str();
      
      std::stringstream ss;
      ss << "Button ID: " << i << newWindow << ".";
      CEGUI::Logger::getSingleton().logEvent( ss.str() );

      mCurrentBar->setVisible( false );

      if( newWindow == "MainTab/Pane1" )
         mCurrentBar = mObjectIconToolBar;
      if( newWindow == "MainTab/Pane2" )
         mCurrentBar = mSectorIconToolBar;
      if( newWindow == "MainTab/Pane3" )
         mCurrentBar = mSceneIconToolBar;
      if( newWindow == "MainTab/Pane4" )
         mCurrentBar = mFileIconToolBar;
      if( newWindow == "MainTab/Pane5" )
         mCurrentBar = mCameraIconToolBar;
      if( newWindow == "MainTab/Pane6" )
         mCurrentBar = mConsoleIconToolBar;

      mCurrentBar->setVisible( true );
      return true;


Now, everything works fine as long as I only click on the main tab buttons of the first tabcontrol... The TabIndex matches the window name and I am able to have correct logic..

My layout is like:
Pane1 | Pane 2 | Pane 3 | etc

and pane1 & 2 each have a child tabcontrol with two buttons each.

If I click on either of pane1's child tabbuttons... And then back on any of the main tab's... the id's get messed up. In this case, Pane6 reports itself as TabIndex 0 when it is clicked.

If instead of clicking on pane1's child tabs, I click on pane2's child tabs... Tab6 reports itself as Tab Index 1.

I've looked at the tabcontrol class and am not sure why this is happening... I see no reason why a child window (in this case a tabcontrol) is having any effect on the parent tabcontrol :\

I can submit my layout file if needed, but it is fairly large.

Re: Nested TabControls Cause Tab Index trouble

Posted: Wed Mar 16, 2005 09:44
by CrazyEddie
Hi,

Nothing springs immediately to mind, I'll need to have a play about and get back to you :)

CE.

Re: Nested TabControls Cause Tab Index trouble

Posted: Wed Mar 16, 2005 21:09
by CrazyEddie
As you know, this is now fixed :)

CE.

Re: Nested TabControls Cause Tab Index trouble

Posted: Wed Mar 16, 2005 21:31
by pjcast
Thanks so much CE! You are the quickest bug finder that I know of =)

:pint: