BCGControlBar Pro for MFC
void CBCGPToolbarCustomize::ReplaceButton ( UINT  uiCmd,
const CBCGPToolbarButton button 

Replaces a toolbar button in the list box of commands on the "Commands" page.

When the customization dialog scans all menus and toolbars, it inserts the buttons into the list box of commands as the regular CBCGPToolbarButton objects. Therefore, if the actual button object is derived from CBCGPToolbarButton, the customization dialog will not recognize it, and if the user tries to insert this button into toolbar, the inserted button will be a CBCGPToolbarButton object.

To prevent this, you need in your code explicitly replace the buttons that are derived from CBCGPToolbarButton.


CBCGPToolbarCustomize* pDlgCust = new CBCGPToolbarCustomize(this,TRUE /* Automatic menus scanning */);
// create the color button and replace a button with its ID in the list box of commands
CBCGPColorMenuButton* pColorButton = m_wndFormatBar.CreateColorButton();
pDlgCust->ReplaceButton(ID_CHAR_COLOR, *pColorButton);
delete pColorButton;
uiCmdSpecifies the command of the button to be replaced.
buttonA const reference the toolbar button object that replaces the old button.