Search code examples
visual-c++mfcmfc-feature-pack

What is difference between CFrameWndEx::AdjustDockingLayout() and CFrameWndEx::RecalcLayout()?


What is difference between CFrameWndEx::AdjustDockingLayout() and CFrameWndEx::RecalcLayout() ?

Both of them to do similar tasks as documentation says: AdjustDockingLayout(), RecalcLayout().

Besides that, Interface Elements doc says that

You can call AdjustDockingLayout or RecalcLayout when you have to adjust the docking layout, and the framework redirects this call to the docking manager.

Does the AdjustDockingLayout() and RecalcLayout() perform same work ?


Solution

  • The AdjustDockingLayout is one level below RecalcLayout. The RecalcLayout calls AdjustDockingLayout. But AdjustDocinkgLayout has an additional parameter for defered windows positioning (HDWP).

    So when the layout of windows are restored from the registry when you start the program or have a mode switch, RecalcLayout isn't called. In this case AdjustDockingLayout is called.

    So whenever you need it internally I would always call RecalcLayout.

    In detail: RecalcLayout calls RecalcLayout for each of its child windows too and finally calls AdjustDockingLayout for the current window only.