From: Pelle on
Hello,

I have an application with a toolbar and I'm using OnUpdateCmdUI to
update Toolbar-Button states.
The Toolbar is derived from CToolbar and has just a few additions.
This is not my work, though.

The Toolbar has 9 Elements, them being 7 Buttons, a checkbox (is
logically a button, too) and a dropdown combo.
The checkbox and dropdown are added dynamically during runtime
(replacing an existing resource), but all the buttons are from the
resource.
Two of the buttons in the resource were just added the other day.
Now when I come to update my button-states I found out that some
buttons were updated and some not. Matter of fact it turned out that
the new buttons were not updated. They do fire the OnCommand message
if clicked though.
I did search in files for all the toolbar-button-ids to check for any
difference to no avail yet.
I did add a static counter to OnUpdateCmdUI and found out that it's
only called 6 times for each toolbar-update-cycle.
I did m_wndToolBar.GetCount(); and iterate through the toolbar-
elements using m_wndToolBar.GetButtonInfo(...) and found 13 Elements,
4 of which were seperators. Thus I assume the toolbar knows about all
it's buttons (just checking it didn't forget some).
Here's what I got from the iteration:
(0) ID=32772, Style=65538, ImgIdx=0
(1) ID=32771, Style=2, ImgIdx=1
(2) ID=32773, Style=2, ImgIdx=2
(3) ID=0, Style=1, ImgIdx=8
(4) ID=33101, Style=1, ImgIdx=175 <--------- dropdown (added
dynamically)
(5) ID=0, Style=1, ImgIdx=8
(6) ID=32778, Style=2, ImgIdx=4
(7) ID=32777, Style=2, ImgIdx=5
(8) ID=0, Style=1, ImgIdx=8
(9) ID=32780, Style=0, ImgIdx=6 <-------- not working
(10) ID=32781, Style=0, ImgIdx=7 <-------- not working
(11) ID=0, Style=1, ImgIdx=8
(12) ID=32782, Style=1, ImgIdx=84 <-------- checkbox (added
dynamically)

Finally I can disable the buttons adding (or'ing) 0x040000 to the
style and using SetButtonInfo, but that doesn't help as long as
OnUpdateCmdUI is not called.
Any ideas on why the toolbar only calls OnUpdateCmdUI for *some* of
it's buttons?

Any pointers are highly appreciated!
Thanks in advance,
Regards,
Pelle.