Page 1 of 1

Child window of ScrollablePane not showing.

Posted: Tue Apr 02, 2019 07:10
by bananaPeel
I have an application that uses CEGUI 0.7.5 perfect fine, however recently I've need to update the application to use CEGUI 0.8.7
Doing so has caused a number of issues however there seems to be one issue I cannot solve.

When I child any type of CEGUI window to a CEGUI ScrollablePane type window it does not want to show the window.

I have searched the forums and couldn't find anything. I have also attempted setting different sizes/positions/visibility etc to no avail :(

Has anyone come across this issue or know a fix / error I have made?

Any help will be greatly appreciated :D

Here is a cut down of the relevant code :

Code: Select all

// Creating Demo Interface:
CEGUI::Window* pRootWindow   = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

// Instruct CEGUI to create the window:
CEGUI::WindowManager& rWindowManager = CEGUI::WindowManager::getSingleton();

// Convert pixel-size to the size relative to the screen:
const CEGUI::UDim udNewElementWidth (0.f, 0.f);
const CEGUI::UDim udNewElementHeight(0.f, 0.f);
const CEGUI::UDim udNewElementLeft  (0.f, 640.f);
const CEGUI::UDim udNewElementTop   (0.f, 384.f);

// Demo Interface TabControl:
{
   CEGUI::Window* pTabControl = rWindowManager.createWindow("TaharezLook/TabControl", "Demo Interface");

   // Set values for the CEGUI Tab Control layout:
   pTabControl->setPosition(CEGUI::Vector2<CEGUI::UDim>(udNewElementLeft, udNewElementTop));
   pTabControl->setSize    (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   pTabControl->setText    ("Demo Interface");
   pTabControl->setName("Demo Interface");
   pTabControl->setVisible(false);
   //pTabControl->setTabHeight(CEGUI::UDim(0.f, 20.f));
   //pTabControl->setTabTextPadding(CEGUI::UDim(0.f, 15.f));
   pTabControl->setWidth(CEGUI::UDim(0.f, 1024.f));
   
   // Add tab control to root window.
   pRootWindow->addChild(pTabControl);
}

// Misc. ScrollablePane:
{
   CEGUI::Window* pMiscTab = rWindowManager.createWindow("TaharezLook/ScrollablePane", "Misc.");

   pMiscTab->setPosition(CEGUI::Vector2<CEGUI::UDim>(udNewElementLeft, udNewElementTop));
   pMiscTab->setSize    (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   pMiscTab->setText    ("Misc.");
   pMiscTab->setVisible(true);
   pMiscTab->setName("Misc.");
   
   pRootWindow->addChild(pMiscTab);

   const CEGUI::UDim udNewElementWidth (0.f, 1024.f);
   const CEGUI::UDim udNewElementHeight(0.f, 0.f);
   pMiscTab->setSize    (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   pMiscTab->setMinSize (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   pMiscTab->setMaxSize (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   
   pMiscTab->setPosition(CEGUI::Vector2<CEGUI::UDim>(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));

   CEGUI::TabControl* pTabControl = dynamic_cast<CEGUI::TabControl*>(pRootWindow->getChild("Demo Interface"));
   pTabControl->addTab(pMiscTab);
}

// Misc. ScrollablePane Elements:
{
   CEGUI::Window* pEnableSound = rWindowManager.createWindow("TaharezLook/RadioButton", "Sound Enabled");

   pEnableSound->setSize    (CEGUI::USize(udNewElementWidth, udNewElementHeight));
   pEnableSound->setText    ("Sound Enabled");
   pEnableSound->setName    ("Sound Enabled");
   pEnableSound->setVisible(true);
   CEGUI::UDim udNewPositionLeft(0.f, 20.f);
   CEGUI::UDim udNewPositionTop (0.f, 10.f);
   pEnableSound->setPosition(CEGUI::Vector2<CEGUI::UDim>(udNewPositionLeft, udNewPositionTop));

   // When adding this window to the misc. ScrollablePane window, it will no longer show the Sound Enabled window!
   // However if i comment it out and leave it set to the root then it will show the Sound Enabled window
   pRootWindow->getChild("Demo Interface/Misc.")->addChild(pRootWindow->getChild("Sound Enabled"));
}

Re: Child window of ScrollablePane not showing.

Posted: Tue Apr 02, 2019 20:09
by Ident
Do you have a minimal repro case? This is quite a complex example and I cannot pinpoint anything down regarding what could be wrong. If you could narrow it down please I could help.

Re: Child window of ScrollablePane not showing.

Posted: Wed Apr 03, 2019 22:57
by bananaPeel
Ident, thanks for your response.

I have since found the reason as to why any child elements to a ScrollablePane were not appearing.
Seems I (think I) have incorrectly set the size of the pane.

The issue is outline in below code:

Code: Select all

// Demo Interface TabControl:
CEGUI::TabControl* pTabControl = dynamic_cast<CEGUI::TabControl*>(CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/TabControl", "Demo Interface"));

// Child tab control to root window.
CEGUI::Window* pRootWindow = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
pRootWindow->addChild(pTabControl);

// Create Misc. ScrollablePane:
CEGUI::ScrollablePane* pScrollablePane = dynamic_cast<CEGUI::ScrollablePane*>(CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/ScrollablePane", "Misc."));

// Child the window to root.
CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(pScrollablePane);

// Below altering the size, causes elements that are or will be childed to pScrollablePane to not show:
const CEGUI::UDim udNewElementWidth(0.f, 1024.f);
const CEGUI::UDim udNewElementHeight(0.f, 0.f);
pScrollablePane->setSize(CEGUI::USize(udNewElementWidth, udNewElementHeight));

// Alter position of pane.
pScrollablePane->setPosition(CEGUI::Vector2<CEGUI::UDim>(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));

// Add ScrollablePane as tab to tabcontrol:
pTabControl->addTab(pScrollablePane);


The issue arose because the size of the ScrollablePane was altered incorrectly?, not sure how this only caused an issue after updating to 0.8.7 though.

Re: Child window of ScrollablePane not showing.

Posted: Sun Apr 21, 2019 19:24
by Ident
I don't know either, if you think it is an actual bug please add a bug ticket on bitbucket or if you are extra good and have a fix, please make a PR :)