-
March 12th, 2012, 10:29 AM
#1
[RESOLVED] Disable the select button in CMFCToolBar
Hi all,
I have a CMFCToolBar with 2 buttons and I want to disable all the buttons if any of them been clicked
I added the following message map:
ON_COMMAND(ID_TOOLBAR_MY_BUTTON1, CMyView::OnButtonClicked1)
ON_COMMAND(ID_TOOLBAR_MY_BUTTON2, CMyView::OnButtonClicked2)
And in the message handler I'm doing the following:
m_wndToolBar.SetButtonStyle(m_wndToolBar.CommandToIndex(ID_TOOLBAR_MY_BUTTON1), TBBS_DISABLED);
m_wndToolBar.SetButtonStyle(m_wndToolBar.CommandToIndex(ID_TOOLBAR_MY_BUTTON2), TBBS_DISABLED);
Both buttons gets greyed out as required but the one I've clicked on gets enable again when the function returns (the second button remains disabled).
It's almost like the button remembers it's state before the click and no matter what I'll do in the message handler the state before the click will be resotored.
(When I look at the CMFCToolBarButton::m_nStyle value after it's been disabled I can see that it is set to 0x0000000)
Any ideas???
-
March 12th, 2012, 10:48 AM
#2
Re: Disable the select button in CMFCToolBar
You're probably better off using the CCmdUI OnUpdate mechanism.
-
March 13th, 2012, 05:47 AM
#3
Re: Disable the select button in CMFCToolBar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|