Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

The ProfStudio sample shows how toolbars can be used on dialogs in dockable control bars. Of course, such toolbars cannot be dockable. For instance, the Class View window is implemented as a resizable dialog (IDD_DIALOG_CLASSVIEW) with a toolbar and a tree-view control inside.


Create a dialog resource in your project and set the same properties for it as it is done for the IDD_DIALOG_CLASSVIEW dialog in the ProfStudio project, copy or create the IDC_CLASS_VIEW_TOOLBAR custom control and define one or more controls to occupy the rest of the dockable dialog. You also need to stick the toolbar to a dialog side. Here is what you need to do in the code:

  •    Define the CExtToolControlBar m_wndToolBar; property in your dockable dialog class and add the line below to the DoDataExchange() method of your dialog class:
  • DDX_Control(pDX, IDC_CLASS_VIEW_TOOLBAR, m_wndToolBar); 
    
  •    Call wndToolBar.LoadToolbar(...) in the OnInitDialog() method
  •    Add the following line at the end of the OnInitDialog() method (the IDC_TREE_CLASS_VIEW value corresponds to the dialog control identifier of the window that should fit the rest of the dialog space):
  • RepositionBars(0,0xFFFF,IDC_TREE_CLASS_VIEW); 
    
  •    Add a WM_SIZE message handler to make both toolbar and your control occupy valid parts of the dockable dialog:
  • void CProfStudioClassView::OnSize(UINT nType, int cx, int cy) 
        {
          CExtResizableDialog::OnSize(nType, cx, cy);
          RepositionBars(0,0xFFFF,IDC_TREE_CLASS_VIEW);
        }