enable/disable toolbar button 
Author Message
 enable/disable toolbar button

Hi,
I thought I would be able to do something like this
m_wndToolBar.SetButtonStyle(m_wndToolBar.CommandToIndex(ID_PRINT),
TBBS_DISABLED);
but I noticed it didn't work.
I also tried GetDlgItem(ID_PRINT) but that returns NULL
How do I disable a toolbar button?

thanks
/Niklas



Sun, 21 Aug 2005 12:17:53 GMT  
 enable/disable toolbar button
You need to add an ON_UPDATE_COMMAND_UI handler.

Something like:-

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
 //{{AFX_MSG_MAP(CMainFrame)
...
 //}}AFX_MSG_MAP
 // Global help commands
 ON_UPDATE_COMMAND_UI(ID_HELP_FINDER, OnUpdateHelpFinder)
...
END_MESSAGE_MAP()

void CMainFrame::OnUpdateHelpFinder(CCmdUI* pCmdUI)
{
 pCmdUI->Enable(FALSE);

Quote:
}

You can do this using class wizard.


Quote:
> Hi,
> I thought I would be able to do something like this
> m_wndToolBar.SetButtonStyle(m_wndToolBar.CommandToIndex(ID_PRINT),
> TBBS_DISABLED);
> but I noticed it didn't work.
> I also tried GetDlgItem(ID_PRINT) but that returns NULL
> How do I disable a toolbar button?

> thanks
> /Niklas



Sun, 21 Aug 2005 12:32:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work

2. How to enable/disable Toolbar button in Dialog Based MFC application

3. Enable/ Disable Toolbar Buttons

4. When to enable/disable toolbar buttons?

5. How do I enable/disable Toolbar buttons?

6. Enable/Disable toolbar button problem 2

7. Enabling/Disabling Toolbar Buttons

8. Enable/Disable toolbar button

9. Enabling/disabling toolbar buttons

10. Dynamically enable/disable toolbar buttons

11. Enable/Disable Toolbar button?

12. Enable / Disable Toolbar Buttons

 

 
Powered by phpBB® Forum Software