tags:

views:

43

answers:

1

Hi,
I need to show a text-only button in a toolbar in MFC. How can I do it?

I'm using Visual Studio 2005, so I'm not using MFC Feature Pack classes.

Thanks

+1  A: 

Try passing -1 as the image index and setting the button's text flag:

toolBar.SetButtonInfo(buttonIndex, buttonId,
    TBBS_BUTTON | TBBS_AUTOSIZE | BTNS_SHOWTEXT, -1);
toolBar.SetButtonText(buttonIndex, "Button Text");
Frédéric Hamidi
It doesn't quite work. I get the button without image, but the text doesn't show. If I make the buttons taller, with SetSizes, then I see the text, but under where the image would be if there were one.
MikMik
Your toolbar control should have the [TBSTYLE_LIST](http://msdn.microsoft.com/en-us/library/bb760439%28v=VS.85%29.aspx) style bit set, so the button text flows to the right of the image instead of below.
Frédéric Hamidi