Dear Christophe,
In form views/child dialogs, the toolbar is most often statically docked at the top of the form/dialog. You may simply implement it either in the form view or in the child dialog window. Please add the custom control to the dialog’s resource and specify:
- ProfUIS-ControlBar as the window class name
0x50002034
value as the window style
- some name as its control identifier (e.g.,
IDC_CUSTOM_CONTROL_ID
)
The location of this control on the resource dialog does not matter because the toolbar window is attached to the top of the form automatically. Please add the
wndToolBar
property of the
CExtToolControlBar
type to your form or dialog class and
DDX_Control( pDX, IDC_CUSTOM_CONTROL_ID, m_wndToolBar )
to the
DoDataExchange
method body. Put the code responsible for initializing the toolbar to
OnInitDialog()
. You may use either
m_wndToolBar.SetButtons(...)
or
m_wndToolBar.LoadToolbar(...)
. Please insert
RepositionBars( 0, 0xFFFF, 0 )
at the end of the
OnInitDialog
and
OnSize
methods. After that, you should see the static toolbar in the form view or child dialog.
To prevent the form view from displaying its scroll bars, you should modify the
OnSize
method, in which you need to call
CWnd::OnSize(
) instead of
CFormView::OnSize()
. To remove the chevron button from your toolbar, use the class below (instead of
CExtToolControlBar
):
class C_NoChevron_ToolControlBar :
public CExtToolControlBar
{
virtual CExtBarContentExpandButton * OnCreateBarRightBtn()
{
return NULL;
}
};
The dockable toolbars (those that can be docked and undocked ) are always assumed to be part of the frame window and they cannot be part of a form view or a dialog. The same is also applicable to other dockable control bars.