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 » Proper use of the command manager Collapse All
Subject Author Date
Dominik Braendlin Oct 4, 2007 - 12:46 AM

Dear Tech Support
As mentioned in my last question our MDI application consists of a main frame e.g. CMainFrame and several different child frames e.g. CMDIChildWnd. http://www.prof-uis.com/Forum_View.aspx?CID=40&M=57803

I am using the g_CmdManager to organize all the Toolbar and Menubar handling. I’ve been having problems while serializing to and from the registry due to missing ID’s. This problem should be solved by know but in order to do this I had to get a closer look at the samples programs and this support form.

Unfortunately I am still a bit uncertain whether I am using the command manger in the right way. Looking at all the samples and forum threads did not give me a somehow consistent picture of the command manager.

At the moment I use in the OnCreate method of the MainFrame ProfileSetup -> ProfileWndAdd -> UpdateFromMenu -> UpdateFromToolbar -> SerializeState. In the DestroyWindow I use SerializeState -> ProfileWndRemove. This seems to work fine but I have seen examples where each child window is also being registered. If I try to do this I am starting to have problems with the dock able toolbars of the child windows. As soon as they are floating they are either gaining or losing text and pictures which I have assigned to them with g_CmdManager->CmdGetPtr -> pCmdItem->m_sToolbarText = string.

What is the common way with an MDI application? Only register the mainframe or do I also need to register the child frames. Our application comes closest to the MDI_InnerOuterBars sample application. One thing I do not understand about the MDI_InnerOuterBars application is why they use the ProfileWndRemove() in the ChildFrame::DestroyWindow(). I cannot see that this child window ever gets registered.

Technical Support Oct 4, 2007 - 11:25 AM

If you have a fixed number of MDI child frame/view/document types in your project, you should register all the toolbars and menus in the main frame’s OnCreate() method. The OnCreate() method in the MDI child frame classes should only create their control bars in this case.

In the case of a variable number of MDI child frame/view/document types (for instance, implemented as plugins ), each MDI child frame should use its unique command profile as the main frame class does. There is one additional restriction related to the CExtMenuControlBar menu bar window: there must be only one instance of the menu bar instance in scope of one command manager’s profile. So, if your MDI child frames have their inner menu bars, these frames should also use their unique command profiles in the command manager. If you are going to make temporarily existing windows like MDI child frames having their unique command profiles, then these profiles should have unique names and the MDI child frame window handle should be removed from its profile which makes the command manager removing profile and all its command descriptions. Please provide us with more details about your project, especially MDI child frame(s), so we can help you.