Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Problem with hiding/showing docked Collapse All
Subject Author Date
Bjorn Lindahl Jan 15, 2009 - 7:06 AM

Hi!



Here’s a long post but I tried to be as informative as I could at once.



If I have two CExtControlBar:s and I dock one into the other as a tab. If I then press the close button, the X the dissappear but the layout isn’t updated so the tab is still visible until I force a redraw moving some other controlbar for instance. If I then go to the View menu and select the appropriate menu selection for each of the controlbars their state seem to be in visible-mode since I have to select each controlbar twice in order to bring them up again.



Also if I make the two Controlbars floating and close them there is some controlbar or something left that dissappear when I dock it. I attach code I see relevant and also two screenshots before closing dialog with tabs and after closing.


So what I wonder is if you see anything wrong in my code below. I don’t have any CExtTabPageContainerWnd or CExtDynamicBarSite to hold the tabbed CExtControlBar, but it ain’t necessary as far as I see in your examples, right?


I have these instances:



CExtControlBarNoCloseButton    m_RadioSimDlgBar;
RadioSimulationDialog m_RadioSimDlg;
CExtControlBarNoCloseButton    m_GPSSimDlgBar;
GPSSimulationDialog m_GPSSimDlg;



Both RadioSimulationDialog and GPSSimulationDialog are classes that inherits from CExtResizableDialog and are created in the resource editor.



Below is the code setting up the prof-uis stuff. I removed creation of other dialogs but they are done the same way as RadioSimulationDialog and  GPSSimulationDialog. Also, the ID_VIEW_RADIOSIMDLG and ID_VIEW_GPSSIMDLG is IDs for menu items in the view menu. This function is called from CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)



bool Application::SetupGUI(CFrameWnd* mframe)
{

    if(    !m_RadioSimDlgBar.Create(
        "Radio Sim", // _T("Optional control bar caption"),
        mframe,
        ID_VIEW_RADIOSIMDLG,
        WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
        |CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE
        )
        )
    {
        TRACE0("Failed to create m_RadioSimDlgBar\n");
        return false;
    }

    if( !m_RadioSimDlg.Create(
        RadioSimulationDialog::IDD,
        &m_RadioSimDlgBar))
    {
        TRACE0("Failed to create RadioSimDlg\n");
        return false;
    }

    if(    !m_GPSSimDlgBar.Create(
        _T("GPS Sim"),
        mframe,
        ID_VIEW_GPSSIMDLG,
        WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
        |CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE
        )
        )
    {
        TRACE0("Failed to create m_GPSSimDlgBar\n");
        return false;
    }

    if( !m_GPSSimDlg.Create(
        GPSSimulationDialog::IDD
        , &m_GPSSimDlgBar) )
    {
        TRACE0("Failed to create GPSSimDlg\n");
        return false;
    }

    m_RadioSimDlgBar.SetInitDesiredSizeFloating(CSize(250, 200));
    m_RadioSimDlgBar.SetInitDesiredSizeHorizontal(CSize( 150, 150 ));
    m_RadioSimDlgBar.SetInitDesiredSizeVertical(CSize( 250, 250 ));

    m_GPSSimDlgBar.SetInitDesiredSizeFloating(CSize(250, 200));
    m_GPSSimDlgBar.SetInitDesiredSizeHorizontal(CSize( 150, 150 ));
    m_GPSSimDlgBar.SetInitDesiredSizeVertical(CSize( 250, 250 ));

    m_RadioSimDlgBar.EnableDocking(CBRS_ALIGN_ANY);
    m_GPSSimDlgBar.EnableDocking(CBRS_ALIGN_ANY);

    if( !CExtControlBar::FrameEnableDocking(mframe) ) 
    {	 
        ASSERT( FALSE );	 
        return -1; 
    }

    m_RadioSimDlgBar.FloatControlBar();
    m_RadioSimDlgBar.DockControlBarIntoTabbedContainer(&m_GPSSimDlgBar);

    m_MainFrame = mframe;

    m_MainFrame->RecalcLayout();
    m_MainFrame->Invalidate();
    return true;
}





Here is other code related to prof-uis that might give you a clue what’s wrong. This code is executed before SetupGUI()



int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
    pApp;

    ASSERT( pApp->m_pszProfileName != NULL );

    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    WINDOWPLACEMENT wp;
    wp.flags = 0;
    wp.showCmd = SW_SHOWMAXIMIZED;
    wp.length = sizeof(WINDOWPLACEMENT);
    CWnd::SetWindowPlacement(&wp);

    CExtPopupMenuWnd::g_bMenuExpanding = false;
    CExtPopupMenuWnd::g_bMenuHighlightRarely = false;
    CExtPopupMenuWnd::g_bMenuWithShadows = true;
    CExtPopupMenuWnd::g_bMenuShowCoolTips = true;
    CExtPopupMenuWnd::g_bMenuExpandAnimation = true;
    CExtPopupMenuWnd::g_bUseDesktopWorkArea = true;
    CExtPopupMenuWnd::g_DefAnimationType = CExtPopupMenuWnd::__AT_FADE;

    VERIFY(
        g_CmdManager->ProfileSetup(
	    pApp->m_pszProfileName,
	    GetSafeHwnd() // HWND of the frame window
	    )
        );

    VERIFY(
        g_CmdManager->ProfileWndAdd(
            pApp->m_pszProfileName,
            GetSafeHwnd()
            )
        );
    
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            pApp->m_pszProfileName,
            IDR_MAINFRAME
            )
        );

Here are screenshots from before and after I closed the control bar holding the tabbed control bars:



Technical Support Jan 20, 2009 - 5:28 AM

Thank you for the detailed explanation. The code snippets in your message looking like absolutely OK. It would be interesting to take a look at the source code of the CExtControlBarNoCloseButton class used in your project.
Does the problem persist if you are using the CExtControlBar class instead of the CExtControlBarNoCloseButton class in your project? What will happen if you insert the CExtControlBarNoCloseButton class into some of our simple sample applications like SDI or SDIDOCVIEW and use it instead of the CExtControlBar class?