Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Disable CExtBarButton on CExtToolControlBar Collapse All
Subject Author Date
Martin Barringer Apr 30, 2010 - 7:31 AM

I have a CExtToolControlBar that is being created on a dialog box. In the OnInitDialog() method of the dialog I want to be able to disable any buttons on the control bar that aren’t applicable. But can’t get it to work. I’ve followed similar code from messages found in the support sections. Here’s the code I’ve implemented:

// Add tool bar buttons here ...

// Disable buttons
int nIndex = m_wndToolBar.CommandToIndex(ID_EXT_PROPERTY);
CExtBarButton *pBtn = m_wndToolBar.GetButton(nIndex);

But when this implements the button is still enabled. I suppose one work around would be to not even add the button to the toolbar. But I would like for it to appear and just be disabled.

Any suggestions as to what I’m doing wrong?

Technical Support May 3, 2010 - 8:28 AM

First of all, please use the CExtResizableDialog class as a base class of your dialog class. The toolbar buttons are fully controlled by the MFC’s command updating mechanism. You should work with the Prof-UIS toolbars inside your dialog class exactly like inside the main frame class. This means you should add the command updating methods for your toolbar’s buttons and use the CCmdUI class methods for disabling or checking the toolbar buttons.