This sort of works. Some buttons seem a little off-centre (even without
text) which I don't understand and a separator gets a gap after it that is
much too big - again, I don't know why. But much more seriously, the overall
toolbar retains the size it would have had if I hadn't added the text to
some buttons. I have tried using SendMessage to send the TB_AUTOSIZE
message to the toolbar (and/or its ctrl) or calling the AutoSize function on
CToolBarCtrl(), but they have no effect at all.
I can't work out what I need to do. I have tried experimenting with flags,
every way I can think. Nothing works. Calling CMainFrame::RecalcLayout(),
resizing the main frame, etc - none of these things make any difference.
I've tried everything I can think of.
Any help with this would be very much appreciated.
Simon
I'm assuming that you are docking the bar horizontally (i.e. top or bottom).
I have used that kind of bars in the past but docked them vertically so all
of the buttons had the same size - I called SetSizes() to achieve it.
One of the things you could try is to call SetButtonInfo() with
BTN_SHOWTEXT|TBSTYLE_AUTOSIZE on buttons with text and TBSTYLE_AUTOSIZE on
buttons without text. That should work. Make sure to get rid of all the
other calls that you have mentioned. All of that should be possible without
using the embedded control (i.e. use only CToolBar).
Bogdan
Thank you for that. I tried that, but it didn't solve the autosize problem.
I did notice one thing I was doing wrong which is that I was including
TBSTYLE_EX_MIXEDBUTTONS as an ordinary style flag, when it needs to be set
separately as an extended flag. Also, I hadn't been calling
InitCommonControlsEx. When I did both of those things, my toolbar looked
somewhat better, but autosizing still didn't work. However, I managed to
solve the problem (I hope!) by creating a derived class from CToolBar and
overriding CToolBar::CalcDynamicLayout. I've since encountered various
other problems with toolbars (like problems with the background colour) and
I'm working my way through those.
Simon
"Bogdan" <bog...@company.com> wrote in message
news:OPGQU0KK...@TK2MSFTNGP03.phx.gbl...
I think (not 100% sure) that combination of styles _FLAT and _LIST makes the
toolbar transparent (i.e. its background only). I'm just curious why the
size of the toolbar is the problem then. You should not be able to tell its
size. Are you docking another bar just to the right of it?
Bogdan
Simon
"Bogdan" <bog...@company.com> wrote in message
news:eB7XOSVK...@TK2MSFTNGP06.phx.gbl...
Do you have a simple sample project to demonstrate this issue? Please also
provide the detailed steps to help us reproduce it. Once we can reproduce
it, we can understand it better and may collaborate with the product team
to help you on it. Thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.