Page 1 of 1

[SOLVED] CEGUI::PushButton::hide() and show() problem

Posted: Mon Mar 12, 2007 15:37
by Salwan
Hi everyone, :)

I am creating a gui application using Ogre 1.2.4 and CEGUI 0.4.1. Right now, I have some sort of a simple script to create/set gui elements.

I have a number of pre-created buttons that the script can use, when I create these buttons I have to hide and disable them until a script uses them.
The problem is that I cant make these buttons visible again, I used ::show() ::activate() ::enable() ::moveToFront() and buttons are still not visible.

what could possible cause this?

Here is the button creation code:

Code: Select all

   mButtonsWindow = CEGUI::WindowManager::getSingleton().createWindow(
      (CEGUI::utf8*)"WindowsLook/FrameWindow", (CEGUI::utf8*)"RulesButtons_Window" );
   mButtonsWindow->setAreaRect( CEGUI::Rect( 0.2, 0.9, 1, 1 ) );
   mButtonsWindow->setProperty( "CloseButtonEnabled", "False" );
   mButtonsWindow->setProperty( "DragMovingEnabled", "False" );
   mButtonsWindow->setProperty( "TitlebarEnabled", "False" );
   mButtonsWindow->setProperty( "SizingEnabled", "False" );
   mButtonsWindow->setFont( mEngine->getGUIMgr()->getArialFont( 12 ) );
   mWindow->addChildWindow( mButtonsWindow );

   mButton1 = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow(
      (CEGUI::utf8*)"WindowsLook/Button", (CEGUI::utf8*)"RulesButton1_Button" );
   mButton1->setPosition( CEGUI::Point( 0.01, 0.1 ) );
   mButton1->setSize( CEGUI::Size( 0.23f, 0.8f ) );
   mButton1->setText( "Button1" );
   mButtonsWindow->addChildWindow( mButton1 );

   mButton1->deactivate();
   mButton1->hide();


and thank you very much

Posted: Wed Mar 14, 2007 22:04
by Pompei2
simple question: did you already check if the buttons are visible if you never hide/deactivate them ?

Solved!

Posted: Wed Mar 14, 2007 23:15
by Salwan
Pompei2: yes I did and they were visible. :)

I solved it, the reason is illogical and irrelevant, but I somehow think it is what caused the problem. :o
Before I call show() and activate() in the same method I had a file opened with ifstream that I forgot to close.
When I closed the file before doing any CEGUI stuff the problem disappeared and buttons hide and show works as it should be now! :?

I am not sure whether that was what fixed the problem or something else, but it was the only significant change that I made to the method that contains the show/activate.

weird...