Disabling Toolbar Buttons
-
I'm working with MFC42 (the one that came with VS6). Is there any way to gray out buttons in the toolbar which have a handler ? I have got a base class for all my dialog boxes, which handles the messages. So every dialog box has got a function which handles the Toolbar messages altough the handler doesn't do anything useful. The users want the buttons with unuseful handlers grayed out, so i have to do this programmatically. Any ideas ?
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -
I'm working with MFC42 (the one that came with VS6). Is there any way to gray out buttons in the toolbar which have a handler ? I have got a base class for all my dialog boxes, which handles the messages. So every dialog box has got a function which handles the Toolbar messages altough the handler doesn't do anything useful. The users want the buttons with unuseful handlers grayed out, so i have to do this programmatically. Any ideas ?
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xxEvery ToolbUtton must have A ID . via Using these Function you can disable them let Button id you want to disable is ID_BUTTON1 then here is little piece of Code.
CButton *But=(CButton*)this->GetDlgItem(ID_BUTTON1); if(But) { But->EnableWindow(FALSE); }
----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk -
I'm working with MFC42 (the one that came with VS6). Is there any way to gray out buttons in the toolbar which have a handler ? I have got a base class for all my dialog boxes, which handles the messages. So every dialog box has got a function which handles the Toolbar messages altough the handler doesn't do anything useful. The users want the buttons with unuseful handlers grayed out, so i have to do this programmatically. Any ideas ?
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xxYou should implement the
[ON_UPDATE_COMMAND_UI](http://msdn.microsoft.com/library/en-us/vclib/html/_mfc_on_update_command_ui.asp) [[^](http://msdn.microsoft.com/library/en-us/vclib/html/_mfc_on_update_command_ui.asp "New Window")]
handler for your button's control ID and then callpCmdUI->Enable( false )
in that handler. -- Affordable Windows-based CMS: www.zeta-producer.de/enu