Jump to content

[SOLVED] InterfaceWindow not showing widgets


photo

Recommended Posts

In our application we are popping out some widgets into separate window something like this:

//PopoutWindow.h

Widget m_content; //not working
Widget test; //working

PopoutWindow( Widget content )
{
      m_content = content;
      test = new WidgetButton(gui, "test button");

      //create new InterfaceWindow
}

void SetWindowDockMode( int mode )
{
    Gui gui = engine.getGui();
    if( mode == WindowMode_Docked )
    {
        m_externalGui.removeChild( m_content );
        m_externalGui.removeChild( test);

        gui.addChild( m_content, GUI_ALIGN_OVERLAP );
        gui.addChild( test, GUI_ALIGN_OVERLAP );

        m_externalWindow.setHidden(true);
    }
    else if( mode == WindowMode_Undocked )
    {
        gui.removeChild( m_content );
        m_externalGui.addChild( m_content );

        gui.removeChild( test);
        m_externalGui.addChild( test);

        m_externalWindow.setHidden(false);
    }

    m_popoutSprite.SetHidden( mode == WindowMode_Undocked );
    m_windowMode = mode;
}

void Update()
{
    if( m_windowMode == WindowMode_Docked )
    {
        // External window is open -> make sure we are in the correct window dock state
        if( m_externalWindow.WasOpened() )
        {
            SetWindowDockMode( WindowMode_Undocked );
        }

        m_content.setHidden( LoadingScreen::IsVisible() ? true : !m_isVisible );

        test.setHidden( LoadingScreen::IsVisible() ? true : !m_isVisible );
    }
    else
    {
        m_content.arrange();
        m_externalWindow.ResizeFor( m_content );

        // Did the user click close?
        if( m_externalWindow.WasClosed() )
        {
            SetWindowDockMode( WindowMode_Docked );
        }
    }
}

Now the issue is, I can see my test button in the separate window but not the "content". What could be the issue here?

 

Note: The same logic use to work with Unigine 1

Link to comment

I will try to do that. It will take some time.

 

But, Do you see anything missed in above snippet? Is there something changed with respect to InterfaceWindow in Unigine 2 (may be some refresh call) ?

Link to comment
×
×
  • Create New...