Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to attach a toolbar to CExtControlbar that contains a dialog-box (CExtResizableDialog) ? Collapse All
Subject Author Date
Saroj Acharya Feb 16, 2005 - 8:41 AM

Hi Customer Support,


I have several controlbars in my application but I would like few of them to have toolbars attached to them. Basically the CExtControlBar contains a dialogbox and is derived from CExtResizableDialog. Furthermore, I do not want these toolbars to be dockable either. They will be attached to this controlbar or to the CExtResizableDialog as non-dockable toolbar. Is iot possible to do this ? If so, I would really appreciate your help.


Saroj

Technical Support Feb 17, 2005 - 2:45 AM

Dear Saroj,

You can use Prof-UIS toolbars in dialogs or other windows and this is not difficult to implement. Of course, the toolbars cannot be dockable in this case. Please run the ProfStudio application and you will see that there are many toolbars like you need. For instance, the Class View window is implemented as a resizable dialog (IDD_DIALOG_CLASSVIEW ) with a toolbar and a tree-view control inside. You could use this construction in your project. Just create a dialog resource in your project and set the same properties for it as in the IDD_DIALOG_CLASSVIEW dialog of 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 will also need to stick the toolbar to the dialog side. Here are what you need to do in the code:

1) Define the CExtToolControlBar m_wndToolBar; property in your dockable dialog class and add the following line to the DoDataExchange() method of your dialog class:

DDX_Control(pDX, IDC_CLASS_VIEW_TOOLBAR, m_wndToolBar); 
2) Invoke wndToolBar.LoadToolbar(...) in the OnInitDialog() method 3) Add this line at the end of the OnInitDialog() method:
RepositionBars(0,0xFFFF,IDC_TREE_CLASS_VIEW); 

The IDC_TREE_CLASS_VIEW value corresponds to the dialog control identifier of the window that should fit the rest of the dialog space.

4) Add a WM_SIZE message handler like the following to make both the toolbar and 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);
    }