Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Disabling Toolbar Buttons

Disabling Toolbar Buttons

Scheduled Pinned Locked Moved C / C++ / MFC
comquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bernhard
    wrote on last edited by
    #1

    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

    T U 2 Replies Last reply
    0
    • B Bernhard

      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

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      Every 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

      1 Reply Last reply
      0
      • B Bernhard

        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

        U Offline
        U Offline
        Uwe Keim
        wrote on last edited by
        #3

        You 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 call pCmdUI->Enable( false ) in that handler. -- Affordable Windows-based CMS: www.zeta-producer.de/enu

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups