Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Disabling a button in a toolbar

hdayvaryhdayvary Member Posts: 35
Hi
In a MDI MFC project I want to change status of a button to disable.
I tried CToolBarCtrl::EnableButton() method,
for example:
m_wndToolBar.GetToolBarCtrl().EnableButton(ID_FILE_OPEN, FALSE);

but it does NOT disable it,
(m_wndToolBar.GetToolBarCtrl().IsButtonEnabled(ID_FILE_OPEN) returns TRUE, but it's not disabled!!!)

Please help
thanks

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : Hi
    : In a MDI MFC project I want to change status of a button to disable.
    : I tried CToolBarCtrl::EnableButton() method,
    : for example:
    : m_wndToolBar.GetToolBarCtrl().EnableButton(ID_FILE_OPEN,
    : FALSE);
    :
    : but it does NOT disable it,
    : (m_wndToolBar.GetToolBarCtrl().IsButtonEnabled(ID_FILE_OPEN) returns
    : TRUE, but it's not disabled!!!)
    :
    : Please help
    : thanks
    [color=Blue]
    Check this out:

    http://msdn2.microsoft.com/en-us/library/72t5ykb7(VS.80).aspx

    It is possible that AFTER you disable this button - the above mechanism enables it back. In other words - you need to use ON_UPDATE_COMMAND_UI() macro instead of doing it directly by code.
    [/color]
Sign In or Register to comment.