Subclass a FrameWindow and instantiate it
Posted: Thu Dec 01, 2011 16:58
Hello,
Usually, I generate FrameWindow with the createWindow function from WindowManager like this:
Now, I'm trying to create a subclass from the FrameWindow that I could instantiate and use easily than this previous method to like this:
The constructor is like this
The thing is that when I instantiate it, and add it to my GUI, nothing appears.
Previsously, I succeded to display something by using a custom class inherithing from CEGUI::Window, and then creating a FrameWindow attached to this class.
Somebody has an idea why it's not working
Thanx for your help
Usually, I generate FrameWindow with the createWindow function from WindowManager like this:
Code: Select all
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::FrameWindow* fWnd = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow( "WindowsLook/FrameWindow", "testWindow" ));
// position a quarter of the way in from the top-left of parent.
fWnd->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0 ), CEGUI::UDim( 0.25f, 0 ) ) );
// set size to be half the size of the parent
fWnd->setSize( CEGUI::UVector2( CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.5f, 0 ) ) );
fWnd->setText( "Hola Que Tal!" );
addChildWindow(fWnd);*/
Now, I'm trying to create a subclass from the FrameWindow that I could instantiate and use easily than this previous method to like this:
Code: Select all
CustomWindow cw("test");
addChildWindow(&test);
The constructor is like this
Code: Select all
CustomWindow::CustomWindow(const CEGUI::String& p_name) : CEGUI::FrameWindow("WindowsLook/FrameWindow", p_name)
{
using namespace CEGUI;
this.setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
this.setSize(UVector2(cegui_reldim( 1.0f), cegui_reldim(1.0f)));
}
The thing is that when I instantiate it, and add it to my GUI, nothing appears.
Previsously, I succeded to display something by using a custom class inherithing from CEGUI::Window, and then creating a FrameWindow attached to this class.
Somebody has an idea why it's not working
Thanx for your help