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 » CExtGridWnd Collapse All
Subject Author Date
Courtney Smith Nov 12, 2007 - 11:09 AM

Hello, I have a problem with the UIstate. We have a dialog that gets created at Oncreate in Mainfrm and it has a CExtGridWnd in it. We hide this until the user calls it up. The problem is that if it doesn’t get viewed it breaks all uistate files when trying to load them to change the GUI. If you view the dialog it doesn’t break the UIstate and you can load the state files, but if you don’t we get a break at DWORD rtPageStates = 0;
ar >> rtPageStates; in function:
void CMainFrame::DoLoadBarStateFromFile()
{
// begin prompting user
CFileDialog dlg(
        TRUE,
        _T("UI state"),
        _T(".\\Default.UI state"),
        OFN_ENABLESIZING|OFN_EXPLORER
            |OFN_LONGNAMES|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST
            |OFN_NOCHANGEDIR|OFN_NODEREFERENCELINKS
            ,
        _T("UI state files (*.UI state)|*.UI state|All files (*.*)|*.*||"),
        this
        );
    dlg.m_ofn.lpstrTitle = _T("Open UI state from file");
    if( dlg.DoModal() != IDOK )
        return;
    ASSERT( dlg.m_ofn.lpstrFile != NULL );
// end prompting user

databasecreate = false;
RemoveExtControlBar( & m_DatabaseResizable);
RecalcLayout();

    try
    {
        CFile _file(
            dlg.m_ofn.lpstrFile, /// specify exact file path instead
            CFile::modeRead|CFile::shareExclusive
            );
        CArchive ar( &_file, CArchive::load);

        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’) );

        ShowWindow( SW_HIDE );
        VERIFY(
            CExtControlBar::ProfileBarStateSerialize(
                ar,
                this,
                &m_dataFrameWP
                )
            );
        VERIFY(
            g_CmdManager->SerializeState(
                pApp->m_pszProfileName,
                ar
                )
            );
//here
DWORD rtPageStates = 0;
ar >> rtPageStates;
m_wndFlatTabPageRealTime.PageVisibleSet( 0, ( rtPageStates & 0x00000001 ) ? true : false );
m_wndFlatTabPageRealTime.PageVisibleSet( 1, ( rtPageStates & 0x00000002 ) ? true : false );
m_wndFlatTabPageRealTime.PageVisibleSet( 2, ( rtPageStates & 0x00000004 ) ? true : false );
m_wndFlatTabPageRealTime.PageVisibleSet( 3, ( rtPageStates & 0x00000008 ) ? true : false );
m_wndFlatTabPageRealTime.PageVisibleSet( 4, ( rtPageStates & 0x00000016 ) ? true : false );
//to here
DWORD fcPageStates = 0;
ar >> fcPageStates;
m_wndFlatTabPageFuture.PageVisibleSet( 0, ( fcPageStates & 0x00000001 ) ? true : false );
m_wndFlatTabPageFuture.PageVisibleSet( 1, ( fcPageStates & 0x00000002 ) ? true : false );
m_wndFlatTabPageFuture.PageVisibleSet( 2, ( fcPageStates & 0x00000004 ) ? true : false );


DWORD iwPageStates = 0;
ar >> iwPageStates;
m_wndFlatTabPageInfoBox.PageVisibleSet( 0, ( iwPageStates & 0x00000001 ) ? true : false );
m_wndFlatTabPageInfoBox.PageVisibleSet( 1, ( iwPageStates & 0x00000002 ) ? true : false );


const int nSel = 0;
m_wndFlatTabPageRealTime.PageSelectionSet( nSel );
m_wndFlatTabPageFuture.PageSelectionSet( nSel );
m_wndFlatTabPageInfoBox.PageSelectionSet( nSel );

        ActivateFrame( SW_SHOW );
return;
    } // try
    catch( CException * pXept )
    {
        CString sErrorDescription;
        VERIFY(
            pXept->GetErrorMessage(
                sErrorDescription.GetBuffer(8192), 8192
                )
            );
        sErrorDescription.ReleaseBuffer();
        ASSERT( !sErrorDescription.IsEmpty() );
        pXept->Delete();
        ActivateFrame( SW_SHOW );
        LPCTSTR display;
        display = "New dialogs are now available in workspace. Please resave workspace.";
        MessageBox(display,
            _T("Update Workspace"),
            MB_OK
            );
    } // catch( CException * pXept )
    catch( ... )
    {
        ActivateFrame( SW_SHOW );
        MessageBox(
            _T("Unknown exception caught"),
            _T("State load failed"),
            MB_ICONERROR
            );
    } // catch( ... )
return;
}
Any help with this would be greatly appreciated.

Thanks in advance.
Courtney

Technical Support Nov 13, 2007 - 2:52 AM

We are sorry but there is not enough information in your message to find out what’s wrong. What is RemoveExtControlBar()? We guess you should verify that the control state data contains exactly the same set of bar state descriptions which match the set of bars really created in the main frame window. This is essential requirement. If you need to make some of your control bars initially hidden in any case, then you should load bar states and then forcibly hide this bar. You should not remove/destroy it. You can set its CExtControlBar::m_bAppearInDockSiteControlBarPopupMenu property to false so this bar will not be present in any of built-in Prof-UIS context menus. As a result, the user will not be able to access this bar.