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

By default, toolbar buttons takes up one row when the toolbar is docked or floating. When it is floating, you can resize it to rearrange buttons in two or more rows but, if you dock it back, its one row layout will be restored back.

You can however set up the toolbar so it has a fixed size and a multiple row layout (also known as a palette layout) even when it is docked (see the figure below). To turn this mode on, set its m_bPaletteMode property to true.

Because this extends the functionality provided by MFC's TBBS_WRAPPED, the following wrap flags were added to the CExtBarButton class:

  •    __EVT_FLOAT
  •    __EVT_HORZ
  •    __EVT_VERT

This allows you to set up three different layouts for when the toolbar is floating, docked horizontally and docked vertically. Please note that in this mode, the toolbar always has a fixed size.

The typical way of setting up a multi row layout for toolbar may look like as follows:

m_wndPalette.m_bPaletteMode = true; // turn on palette mode for toolbar
int nBtnIdx = m_wndPalette.GetButtonsCount(); // get count of toolbar buttons (you may need it)

// set wrap flags for a particular button i:
m_wndPalette.GetButton( i )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( i )->SetWrap( CExtBarButton::__EVT_HORZ );

You can find an example of setting up a palette layout in the DRAWCLI sample.