So we are in the process of updating our application to now use the Prof-UIS toolbars and docking windows. We have toolbars and docking windows from a previous library we used, but have decided to change.
This previous library would, as yours does, save and load the state of toolbars if so desired. I am in trying to load this old information in, set the data as appropriate in the new toolbars, and get things to at least closely approximate the locations where they were saved. No customization is in place, this is strictly which toolbars are showing and where.
I get the data out of the old system’s file, and place all relevant information into a CControlBarInfo structure. I update locations and rectangle sizes as needed to accomodate the new toolbar sizes with the current theme that is being used. I utilize SetBarInfo to pass the information to the individual toolbars. However, if I don’t also call CFrameWnd::DockControlBar with an appropriate rectangle, toolbars will always appear on their own rows. Basically this equates to the following steps:
- Find out from the old file which dockbar we are dealing with. The old file will tell me the IDs of the bars docked to this side.
- Find the bar info of the bars docked to this side that are visible.
- Adjust the m_pointPos and m_rectMRUDockPos as needed to accomodate new height and width of Prof-UIS version of toolbar.
- Call CControlBar::SetBarInfo, passing in the new information.
- Call CFrameWnd::DockControlBar with the appropriate dock bar ID and m_rectMRUDockPos (updated to screen coordinates).
The first set of data i load works beautifully. Any subsequent loads, even loading the same information twice, results in the bars not going where they should. If, for example, all bars are docked to the top, upon first load they are neatly placed next to one another. Upon the second load of the saved data, their X coordinate is correct, but each bar is on its own row.
[.....][.....] <-- First load of saved toolbar data and first use of the above sequence.
[.....]
[.....] <-- Second load of same data, second time through the above sequence.
Am I leaving something out? Is there something extra I need to do? If I debug through the sequence, the same coordinates are calculated every time through with the same data load...
Kevin Murray
AGI