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 » Toolbars state serialization Collapse All
Subject Author Date
Sergio Buonanno Mar 2, 2006 - 6:39 AM

My MDI application uses toolbars inside the MDI child windows. Each MDI child window is different from one another and so the toolbar. When the application starts it loads the toobars state from a disk file using g_CmdManager->SerializeState, but this function fails with an exception. It looks like Command Manager is trying to load the state of the MDI child windows’ toolbar that do not exist at application startup. Is there the possibility to avoid this problem ? Or to skip serialization for a particular toolbar ?

Thanks

Technical Support Mar 2, 2006 - 10:48 AM

The CExtCmdManager::SerializeState() loads/saves the info relating to non-basic commands stored in the command manager. This method has nothing to do with any control bar. The CExtControlBar::ProfileBarStateLoad() loads the state of bars. So, the problem does not relate to toolbars and control bars. We may guess you should check how your application updates the command manager with command descriptions. If there is only one command profile in your project and it is initialized in the main frame window, then please check that this command profile is updated from all the menu and toolbar resources used in your application including menus and toolbars from the main frame window and all the MDI child frame windows. If the problem persists, the last ditch resort to let us review your project.

Sergio Buonanno Mar 3, 2006 - 12:55 AM

Unfortunately that is. If I open more MDI child windows (that in their turn load their own toolbar from resources by calling LoadToolBar), then I close the application; next time I run it again CExtCmdManager::SerializeState fails and launches an exception. The exception is launched from line 1818 of extcmdmanager.cpp because CmdGetPtr(nCmdId) returns a NULL CExtCmdItem pointer.
I don’t know why but that happens only when I open some MDI child windows each with a different toolbar.

Technical Support Mar 4, 2006 - 4:23 AM

We are still guessing that you update the command manager partially in the main frame and partially in your child frame windows. This explains why the number of command descriptions depends on whether you have opened some MDI child frames or not. Moving the code that updates the command manager to the main frame window should fix the problem. Some methods can update the command manager automatically (CExtPopupMenuWnd::TrackPopupMenu(), CExtToolControlBar::LoadToolBar()). Your MDI application needs to update the command manager with all the resources used in all the MDI child frames in the CMainFrame::OnCreate() method, with the g_CmdManager->UpdateFrom...(...) code being invoked explicitly for all the toolbar and menu resources. We can review your (test) project if you send it to us.