RobNHood RobNHood - 2 months ago 29
C++ Question

Enabling\disabling CMFCToolBar buttons when embedded in pane

I know the best way to enable/disable a button from CMFCToolBar is to use

int b_id = m_ToolBar.CommandToIndex(ID_BUTTON);

but that does not seem to work when the toolbar is embedded inside a CDockable Pane I have a derived class for CMFCToolBar which is required to enable the buttons in a pane but nothing I have tried will disable them.


OK I found the only solution was not to use the standard methods of disabling the buttons but to put the conditions in each of the on command update functions and use pCmdUI->Enable(FALSE); not much unlike what you would do to menus.