Reputation: 2436
How to make a CMFCToolBar
display its buttons' text labels right to their icons?
Because a CMFCToolBar
is not a standard common control Toolbar, I can't just set a TBSTYLE_LIST
flag to do it.
I can't use a CToolBar
or CToolBarCtrl
instead because they don't work well with my CDockablePane
s.
Upvotes: 1
Views: 2340
Reputation: 1530
You should use CMFCToolBar::SetToolBarBtnText() method. Toolbar must be created with TBSTYLE_FLAT control style.
if (m_MyToolBar.CreateEx(this, TBSTYLE_FLAT, AFX_DEFAULT_TOOLBAR_STYLE | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1, 1, 1, 1))
&&
MyToolBar.LoadToolBar(nToolBarResourceID))
{
m_MyToolBar.SetToolBarBtnText( MyToolBar.CommandToIndex(ID_MY_CMD), _T("My command"));
}
That is all.
Upvotes: 1
Reputation: 4590
Those classes were ported from the BCG toolkit. The documentation is pretty poor. You should be able to set the button class public member variable m_bText to true and set the text in m_strText.
Upvotes: 0
Reputation: 5132
Try the EnableTextLabels function of the CMFCToolBar
-- says "Enables or disables text labels under toolbar button images"
Upvotes: 0
Reputation: 11957
Can't you use CreateEx and pass TBSTYLE_LIST as the dwCtrlStyle parameter?
Upvotes: 1