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 General Discussion » Restoring EDBS_Document state Collapse All
Subject Author Date
Andrew Harding Apr 19, 2006 - 5:24 PM

Is CExtDynamicBarSite::StateLoad supposed to restore CExtDynamicControlBars which have the EDBS_Document state if CExtDynamicBarSite::StateLoad has already been called once before? Both the MDI_DynamicBars example and my code have problems if you save the state and then hide some of the tabbed documents and then restore the state. The hidden documents will not restore. The normal docking bars restore just fine.

I would like to be able to use the save / restore feature in my application so that a user can save a layout then play around with the window positions and visibility, if they don’t like the layout then can just press the restore menu item and all of the windows would revert to their previously saved state / visibility / position / size.

Andrew Harding Apr 20, 2006 - 2:58 PM

I have *sort of* fixed the problem in my code. I had to call both CExtDynamicBarSite::StateLoad and CExtControlBar::ProfileBarStateSave. The only problem with this is that it also means that I need to destroy all of the windows and re-create them from scratch since dynamic controlbars are automatically allocated on CExtDynamicBarSite::StateLoad. This isn’t a huge problem however, it just means I’ll need to make sure I store whatever information I want to preserve temporarily while the windows are reloaded.

Technical Support Apr 21, 2006 - 7:38 AM

You can mark some of dynamic control bars as persistent. The persistent control bars must have persistent identifiers and they are not recreated when the state is loaded. For example, in the SDI_DynamicBars and MDI_DynamicBars samples, the control bar CMainFrame::m_pBarPersistent is a persistent dynamic control bar. It is allocated in the CMainFrame::OnCreate() method using the following code:

m_pBarPersistent =
    CExtDynamicBarSite::BarAlloc(
    _T("Persistent Bar"),
    icon,
    0,
    RUNTIME_CLASS(CSimpleControlBar),
    true // this bar is persistent
    );