0

I have several Toolbars/Menubars derived from the code Sizing Control Bar that I would like to be able to use with CFrameWndEx but I'm unable to find an easy to use the ShowPane functions with the CControlBar derived objects.

For instance with CFrameWnd:

ShowControlBar(&m_ctlDimBar, m_ctlDimBar.IsVisible(), FALSE);

Needs to be replaced, when using CFrameWndEx, with:

ShowPane(&m_ctlDimBar, m_ctlDimBar.IsVisible(), FALSE, TRUE);

Yet I can't use m_ctlDimBar as is because it is a CControlBar derived object and not a CBasePane object. Is there an easy way to circumvent the incompatibility without having to rewrite the code from the link?

Niall
  • 30,036
  • 10
  • 99
  • 142
Jak
  • 471
  • 5
  • 20
  • It depends how you do it. I always use Windows derived from CBCGPDockingControlBar. And they work the same way. – xMRi Sep 02 '14 at 11:59
  • It looks like CBCGPDockingControlBar is third party? – Jak Sep 02 '14 at 12:01
  • Microsoft had joined hands with BCGSoft to bundle their controls as "MFC Feature Pack". – Gautam Jain Sep 02 '14 at 12:15
  • That's true, but, the feature pack does not provide the source code. BCG bundles the source with their product. and, it's a good thing because the documentation for the Feature Pack and BCG is horrible. You learn a lot more from reading the code. – rrirower Sep 02 '14 at 12:19
  • So how can I take advantage of that and use CBCGPDockingControlBar? – Jak Sep 02 '14 at 12:29
  • I am sorry. I mixed this stuff. The internal structure changed here. CPane is what in CBCGControlBar. So CDockingPane is the same as CBCGPDockingControlBar. CBCGPToolBar -> CBCGPBaseToolBar -> CBCGPBaseControlBar -> CBCGPWnd CMFCToolBar -< CMFCBaseToolBar -> CPane -> CWnd – xMRi Sep 03 '14 at 10:11

1 Answers1

1

CControlBar is the old world of toolbars, when you use the new MFC style you must use all components from the CMFC classes. Sadly not all of the new classes start with CMFC.

So if you have a CControlBar with some content that should be dockable use CDockingPane now.

CControlBar was the old base class for CToolBar and other.

The new classes are derived in this way: CMFCToolBar -< CMFCBaseToolBar -> CPane -> CWnd

CPane is the nearest baseclass for you and the CDockingPane is the window class that allows you to place your own content.

The easiest way to find out how this new stuff works is to create a sample application with the wizard. Than look at the base classes how the different kind of windows are implemented. The description is horrible and nearlynot existing. But usingthe code isn't so complicated. ;)

PS: After I wrote some comments I try an answer.

xMRi
  • 14,982
  • 3
  • 26
  • 59