Can't get the TabControl to work

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Can't get the TabControl to work

Postby BradDaBug » Sun Jun 18, 2006 22:48

I've read how it's supposed to work, but I can't get any tabs to show up. Here's some psuedocode:

Code: Select all

TabControl* tc = CreateTabControl(parentWindow);
tc->SetSize(1.0f, 1.0f);
tc->SetPosition(0.0f, 0.0f);

Window* t1 = CreateDefaultWindow();
Window* t2 = CreateDefaultWindow();
t1->setText("tab1");
t2->setText("tab2");
tc->addTab(t1);
tc->addTab(t2);


This doesn't work. tc->getTabCount() returns 2, as it should. And the background of where the tab control should be is black instead of the background the rest of the windows have, so it must be rendering something. But I don't see any tab buttons. Am I skipping a step? Or is there some deeper issue?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jun 19, 2006 00:09

Have a lookt at Widget Galore. I used the Layout Editor to create a TabControl and as many TabPane as needed (rather than DefaultWindow). Then I placed widgets onto those TabPanes. Finally in code I called setText(), setSize(), and setPosition() on each TabPane before adding them to the TabControl via addTab().

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Wed Jul 12, 2006 22:37

I am having this problem, too. What worked in 0.4.1 doesn't work in 0.5.0. Furthermore, there seems to be NO samples to show a usage of or that it actually works in 0.5.0. :(


This did work before, but now it doesn't:

Code: Select all


<Window Type="Origins/FrameWindow" Name="Chat/FrameWindow" >
<Property Name="Text" Value="Communiques" />
<Property Name="TitlebarEnabled" Value="True" />
<Property Name="UnifiedAreaRect" Value="{{0.169875,0.000000},{0.251111,0.000000},{0.619875,0.000000},{0.751111,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />

<Window Type="Origins/TabControl" Name="Chat/TabControl" >
<Property Name="UnifiedAreaRect" Value="{{0.000000,15.000000},{0.100000,0.000000},{1.000000,-15.000000},{1.000000,-100.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />

<Window Type="Origins/TabPane" Name="Chat/Control/Tab" >
<Property Name="Text" Value="Control" />
<Property Name="UnifiedAreaRect" Value="{{0.000000,0.000000},{0.000000,0.000000},{1.000000,0.000000},{1.000000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />

<Window Type="Origins/StaticText" Name="Chat/Control/Channel/StaticText" >
<Property Name="FrameEnabled" Value="False" />
<Property Name="Text" Value="Channel:" />
<Property Name="UnifiedAreaRect" Value="{{0.010000,0.000000},{0.100000,0.000000},{0.260000,0.000000},{0.250000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>

</Window>

</Window>



The TabControl never renders and neither does antthing contained with-in the tab control.

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Wed Jul 12, 2006 22:56

Strange, the tab control in my project continues to work in this new CEGUI version. Heres some code:

Code: Select all

   TabControl* tcLevels = static_cast<TabControl*>(winMgr.createWindow("WindowsLook/TabControl", STR_TC_LEVELTYPE));
   tcLevels->setWindowPosition(UVector2(cegui_reldim(0.025f), cegui_reldim(fltWndwSectYPadd)));
   tcLevels->setWindowSize(UVector2(cegui_reldim(0.95f), cegui_reldim(fltWndwSectHeight)));
   tcLevels->setTabHeight(cegui_reldim(0.15f));
    tcLevels->setTabTextPadding(cegui_reldim(0.05f));   
   siMainPanel->addChildWindow(tcLevels);


And adding a tab to it:

Code: Select all

      listBoxGroups = static_cast<Listbox*>(winMgr.createWindow("WindowsLook/Listbox", STR_LB_GENERAL));
      listBoxGroups->setWindowPosition(UVector2(cegui_reldim(0.05f), cegui_reldim(0.05f)));
      listBoxGroups->setWindowSize(UVector2(cegui_reldim(0.9f), cegui_reldim(0.9f)));
      listBoxGroups->setText("General");
      tcLevels->addTab(listBoxGroups);

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Wed Jul 12, 2006 23:03

@spannerman,

You are creating the TabControl in code.... I will try that and see if that makes a difference. However, I am loading from an XML layout file. Is anyone else doing it my way (i.e. from a file vs code)?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Jul 12, 2006 23:41

Van, did you go to Widget Galore, tried it, and found that it did not work? That's v0.5 code, WITH a .layout file.

From your code I'm seeing the following pattern:

Code: Select all

<Window Type="Origins/FrameWindow" Name="Chat/FrameWindow" >
  <Window Type="Origins/TabControl" Name="Chat/TabControl" >
    <Window Type="Origins/TabPane" Name="Chat/Control/Tab" >
      <Window Type="Origins/StaticText"
      </Window>
    </Window>
</Window>


Follow this pattern instead:

Code: Select all

<Window Type="Origins/FrameWindow" Name="Chat/FrameWindow" >
  <Window Type="Origins/TabControl" Name="Chat/TabControl" >
  </Window>
</Window>

<Window Type="Origins/TabPane" Name="Chat/Control/Tab" >
  <Window Type="Origins/StaticText"
  </Window>
</Window>


Then in code:

Code: Select all

TabControl* winTabControl = static_cast<TabControl*>(winMgr.getWindow("Chat/TabControl"));
Window* tabPage = winMgr.getWindow("Chat/Control/Tab");
tabPage->setText("Page 1");
tabPage->setWindowSize(UVector2(UDim(1.0f, 0.0f), UDim(1.0f, 0.0f))); // Size to 100% of its parent, the TabControl
tabPage->setWindowPosition(UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f))); // Move to the upper left corner of its parent
winTabControl->addTab(tabPage);

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Wed Jul 12, 2006 23:42

Big thanks to sueastside and lindquist who help resolve this issue on the IRC.

The problem is that you must set the tab height by calling CEGUI::TabControl::setTabHeight(). That made the TabControl appear.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Thu Jul 13, 2006 01:06

@Rackle,

Your pattern for adding Tabs is only for getting around the Layout Editors weakness - because there is STILL NO FREAKING TAB SUPPORT. :evil: It works the way I did it as along as you add the tab height.

User avatar
jacmoe
Just can't stay away
Just can't stay away
Posts: 136
Joined: Sun Apr 03, 2005 14:18
Location: Holbaek, Denmark
Contact:

Postby jacmoe » Thu Jul 13, 2006 03:49

Van, why don't you roll up your sleeves and get that tab support in, if you really want it that bad?!?!? :)

*Admin Editted: Removed swearing*

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Thu Jul 13, 2006 11:10

jacmoe wrote:Van, why don't you roll up your sleeves and get that tab support in, if you really want it that bad?!?!? :)


LOL. I love people who get right to the point. ;)

Well, the fact is, someone else has already written it sometime ago. I have downloaded it and have installed it into a version of the Layout Editor. So, I'm not bitching about "Why hasn't it been written?", I'm bitching about "Why hasn't it been incorporated?". It's been available for sometime now. I refer to:

http://www.cegui.org.uk/phpBB2/viewtopi ... ab+support

User avatar
jacmoe
Just can't stay away
Just can't stay away
Posts: 136
Joined: Sun Apr 03, 2005 14:18
Location: Holbaek, Denmark
Contact:

Postby jacmoe » Thu Jul 13, 2006 15:27

This patch hasn't been applied. Maybe ScriptKid forgot?
Or did they run into some issues?
Van, you have a point. :wink:

But why are you being so goddamn rude? :(

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Thu Jul 13, 2006 16:20

jacmoe wrote:This patch hasn't been applied. Maybe ScriptKid forgot?


Eh, I don't think so. IMHO ScriptKid just isn't focused on making a tool - he's more focused on programming and goes about changing and addding features that are nice but are not relevant. Again, I refer to th fact that 0.5.0 only loads "*.layout" files now. Why was this changed? It's not a bad tool, of coarse it's the only tool, but it has bugs that go way back that have been pointed out but still haven't been addressed. :(

jacmoe wrote:But why are you being so goddamn rude? :(


Rude? I'm not being rude - sarcastic, but never rude.

User avatar
jacmoe
Just can't stay away
Just can't stay away
Posts: 136
Joined: Sun Apr 03, 2005 14:18
Location: Holbaek, Denmark
Contact:

Postby jacmoe » Thu Jul 13, 2006 16:54

sarcasm doesn't translate to this medium, believe me.
I was a royal PITA before I realised that.
It translates to hostile rudeness.

And it doesn't help you much either. People just stop listening.

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Thu Jul 13, 2006 20:58

I have locked this thread now for obvious reasons.

van, the truth is, you are being rude, and a quick scan through your Cegui (and Ogre) forum posts show that this is not a fleeting habit; you know it and so does everybody else. You are of course entitled to your opinion but please be reasonable. More often than not your posts are negative and non-constructive which tends to rub people up the wrong way. Here is just one example of many.

Please try to keep your future posts more positive (without descending into sarcasm) and let’s end this amicably.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 22 guests