Subclass a FrameWindow and instantiate it

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

matt
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Tue Nov 08, 2011 16:00

Subclass a FrameWindow and instantiate it

Postby matt » Thu Dec 01, 2011 16:58

Hello,

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

Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests