[SOLVED]TabControl without a defined visible child

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

User avatar
Tiblanc
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Sun Sep 13, 2009 01:27
Location: Quebec, Canada

[SOLVED]TabControl without a defined visible child

Postby Tiblanc » Sun Oct 04, 2009 23:32

Hi all!

I'm using CEGUI 0.7 with Ogre 1.6.3. I'm not sure if this is intended or a bug. If I have a TabControl widget with child tabs and none have their Visible property set to True, then it will look like the first tab is selected, but its contents will not be displayed. Clicking on the tab displays the contents.

This is how I define the tabs in my layout file.

Code: Select all

    <Window Type="TaharezLook/FrameWindow" Name="TemplateEdit">
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedSize" Value="{{0,610},{0,700}}"  />
        <Property Name="Text" Value="Template Edit" />

        <Window Type="TaharezLook/TabControl" Name="TemplateEdit/ComponentTabs">
            <Property Name="UnifiedPosition" Value="{{0,10},{0,5}}"  />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedSize" Value="{{1,-20},{1,-280}}"  />
            <Property Name="TabPanePosition" Value="Top" />
            <Property Name="TabHeight" Value="{0,25}" />

            <Window Type="DefaultWindow" Name="TemplateEdit/ComponentTabs/ModelTab" >
                <Property Name="Text" Value="Model" />
                <Property Name="Visible" Value="False" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
                <Property Name="Visible" Value="True" />

                <Window Type="TaharezLook/StaticText" Name="TemplateEdit/ShipModelLabel">
                    <Property Name="UnifiedPosition" Value="{{0,5},{0,5}}"  />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedSize" Value="{{0,200},{0,30}}"  />
                    <Property Name="Text" Value="Ship Model" />
                </Window>

                <Window Type="TaharezLook/Combobox" Name="TemplateEdit/ShipModelCombobox">
                    <Property Name="UnifiedPosition" Value="{{0,210},{0,5}}"  />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedSize" Value="{{0,250},{0,300}}"  />
                    <Property Name="ReadOnly" Value="True" />
                </Window>

            </Window>
           
            <Window Type="DefaultWindow" Name="TemplateEdit/ComponentTabs/WeaponTab" >
                <Property Name="Text" Value="Weapons" />
                <Property Name="Visible" Value="False" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
            </Window>
        </Window>
    </Window>

If I remove the <Property Name="Visible" Value="True" /> for the Models tab, then it will look as if the Models tab is selected, but nothing will appear. With the property, all is fine.
Last edited by Tiblanc on Mon Oct 05, 2009 20:26, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: TabControl without a defined visible child

Postby CrazyEddie » Mon Oct 05, 2009 08:45

I have some vague recollection of something like this being raised previously, though I did not go looking for it.

I'll check it out.

Thanks

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: TabControl without a defined visible child

Postby CrazyEddie » Mon Oct 05, 2009 17:59

Ok. This is kind of half bug and half non-intended usage... At the heart of the issue is that you're setting the pane contents visibility to false, so technically the fact it's not shown is what you've asked for. Though of course the TabControl should (and indeed does) set the first tab added to be active and visible, the issue occurs due to the order of creation and other events, which is like this (all happens in layout loading)...

Create TabControl
Create first tab content window
Add tab content window to TabControl
TabControl sets the content window to be visible
Apply properties to tab content window (thus, re-setting it's visible state back to false)
Add tab content window children
... and so on ...

As you can see, the issue arises in the step where properties are applied to the content window - by the time these properties are set, the window has already been added to the TabControl.

So, as I say. It's not really a bug, but an artefact of the order of process in layout loading.

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 2 guests