Page 1 of 1

[SOLVED]Custom rendering FrameWindow resize

Posted: Thu Aug 30, 2012 19:34
by Tabarn@kdeca.lis
I want to resize with the mouse a custom FrameWindow created according to this tutorial : ... right_time

I updated to CEGUI 0.7.7. My problem is the custom FrameWindow I create will never receive the FrameWindow::onMouseEvent where the border detection occur. Only the root FrameWindow will have the onMouseEvent. As I understand, the topmost child should receive the event first then decide wether or not to propagate it to it's parents.

So basically, I have the root FrameWindow :

Code: Select all

   m_pfwRoot = (CEGUI::FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", FRAME_WINDOW_ROOT );
   m_pfwRoot->setPosition( UVector2( UDim(0.0f, 0), UDim(0.0f, 0) ) );
   m_pfwRoot->setSize( UVector2( UDim(1.0f, 0), UDim(1.0f, 0) ) );
   m_pfwRoot->setDragMovingEnabled( FALSE );
   m_pfwRoot->setDragDropTarget( FALSE );
   m_pfwRoot->setTitleBarEnabled( FALSE );
   m_pfwRoot->setSizingEnabled( FALSE );
   m_pfwRoot->setFrameEnabled( FALSE );
   m_pfwRoot->setSizingBorderThickness( 0.0f );
   m_pfwRoot->setRollupEnabled( FALSE );

   CEGUI::System::getSingleton().setGUISheet( m_pfwRoot );

Then I create custom FrameWindow :

Code: Select all

      // register the new window type
      CEGUI::WindowFactoryManager::getSingleton().addFactory<CEGUI::TplWindowFactory<GLCEGUISpectrogram> >();
      // make a mapping that uses the existing TL/FrameWindow renderer.
      CEGUI::WindowFactoryManager::getSingleton().addFalagardWindowMapping(   "TaharezLook/GLCEGUISpectrogram", "GLCEGUISpectrogram", "TaharezLook/FrameWindow", "Falagard/FrameWindow"   );


   m_pfwSpectrogramWindow = static_cast<GLCEGUISpectrogram*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/GLCEGUISpectrogram", strWindowName) );

   m_pfwSpectrogramWindow->setPosition( CEGUI::UVector2( CEGUI::UDim( fXPos, 0.0f), CEGUI::UDim( fYPos, 0) ) );
   m_pfwSpectrogramWindow->setSize( CEGUI::UVector2( CEGUI::UDim(fWinDefaultWidth, 0), CEGUI::UDim(fWinDefaultHeight, 0) ) );
   m_pfwSpectrogramWindow->setText( strTitle );
   m_pfwSpectrogramWindow->setDragMovingEnabled( TRUE );
   m_pfwSpectrogramWindow->setTitleBarEnabled( TRUE );
   m_pfwSpectrogramWindow->setSizingEnabled( TRUE );
   m_pfwSpectrogramWindow->setFrameEnabled( TRUE );
   m_pfwSpectrogramWindow->setSizingBorderThickness( 15.0f );
   m_pfwSpectrogramWindow->setZOrderingEnabled( TRUE );
   m_pfwSpectrogramWindow->setInheritsAlpha( FALSE );

   CEGUI::WindowManager::getSingleton().getWindow( GLWindowCEGUI::FRAME_WINDOW_ROOT )->addChildWindow( m_pfwSpectrogramWindow );

I wonder why only the first root FrameWindow will receive the event. The custom FrameWindow works when I drag the title bar or when I double click on the title bar to hide it's content.

Have you got any clues? I will continue to debug.


Re: Custom rendering FrameWindow resize

Posted: Thu Aug 30, 2012 20:18
by Tabarn@kdeca.lis
Edit : removed log file since it was useless.

Re: Custom rendering FrameWindow resize

Posted: Thu Aug 30, 2012 20:38
by Tabarn@kdeca.lis
OK, I made it! My problem was that I had a bad useless implementation of isHit and onMouseMove in my custom FrameWindow.

If you have similar problems, make sure these methods are not overriden, or call the parent class method!