0

I would like to put a menu inside a CDockablePane so that the pane can have a standard menu as well as a toolbar. The menu itself does not have to be dockable (neither does the toolbar).

As my first attempt, I started with a standard SDI from the VS project wizard, with a dockable Properties pane from which I cut out all the content except the toolbar (I'll be adding a form view eventually). I then tried putting a standard CMFCMenuBar into the pane in much this same way as is done for the main menu in the main frame, but with the dockable pane as the parent. This eventually displays OK in the pane, but only after ignoring various ASSERTS along the way (and on exit), presumably because it is expecting a CFrameWndEx rather than CDockablePane as parent. I suspect it's getting in a tangle with the main frame dock manager. enter image description here

I would greatly appreciate any advice (or better still sample code) on how to do this properly. Clearly the CMFCMenuBar route is a kludge.

Bill Heitler
  • 187
  • 3
  • 13
  • Have you tried [`CWnd::SetMenu`](https://msdn.microsoft.com/en-us/library/0ka22dbz(v=vs.120).aspx?f=255&MSPPError=-2147217396) on the Dockable Pane itself? – sergiol Jun 05 '17 at 17:45
  • Wouldn't it be better to use a Toolbar with menu buttons? Menus are usually only for main frames. – xMRi Jun 07 '17 at 05:54
  • Thanks for the input. I tried CWnd::SetMenu, but nothing displays. I'm not sure but I don't think this call actually makes a menu. – Bill Heitler Jun 07 '17 at 12:51
  • I also tried going down the Toolbar menu route, using an old post on CodeProject from Neil Yao as the base. However, for some reason (perhaps to do with the docking manager?) the ToolBar displaying the menu gets corrupted with bitmap images from other toolbars like the MainFrame. I simplified down, and found that this happens even with just a raw CToolBarCtrl when it is created in the docking pane, without adding any code to it at all. So I'm a bit stuck. – Bill Heitler Jun 07 '17 at 13:00

0 Answers0