Article ID: 151162
Article Last Modified on 11/21/2006
APPLIES TO
- Microsoft Foundation Class Library 4.2, when used with:
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 4.1 Subscription
This article was previously published under Q151162
SYMPTOMS
CToolBarCtrl styles such as CCS_ADJUSTABLE are ignored by
CToolBar::Create(), and do not have any affect on the CToolBar that is
created.
The Common Control Toolbar controls styles that are ignored include
CCS_ADJUSTABLE, CCS_BOTTOM, CCS_NOHILITE, CCS_TOP, and the Toolbar styles
TBSTYLE_ALTDRAG, TBSTYLE_TOOLTIPS and TBSTYLE_WRAPABLE.
CAUSE
CToolBar is an implementation of the Common Control Toolbar and requires
specific flags. Before calling CWnd::Create() to create the Toolbar
control, CToolBar removes all styles in the range of 0 to 0xFFFF. This
includes all of the CControlBar (CBRS_X) styles as well as the Common
Control styles.
The following Common Control styles are then set:
CCS_NOPARENTALIGN, CCS_NOMOVEY, CCS_NODIVIDER, and CCS_NORESIZE
RESOLUTION
One solution is to use ModifyStyle in the handler for WM_NCCREATE to set
the styles needed.
CToolBarCtrl may also be used instead of CToolBar when modifying the
toolbar using the Common Control styles, but the CToolBarCtrl does not
support all of the functionality of CToolBar, such as docking, automatic
CFrameWnd layout and CmdUI updates. The CToolBarCtrl notifications arising
due to these styles also have to be handled.
It is possible to set the Common Control styles in CToolBar by deriving a
class from CToolBar and overriding the virtual function
CToolBar::PreCreateWindow(). This may cause problems because some of the
CCS_X styles have the same value as some of the CBRS_X styles. For example,
CBRS_FLYBY and CCS_ADJUSTABLE are both 0x0020L.
Additional query words: 4.00 4.10
Keywords: kbcmnctrls kbmfcctrlbar kbprb kbtoolbar kbuidesign KB151162