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. disable/enable toolbar buttons in a dialog

disable/enable toolbar buttons in a dialog

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 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.
  • M Offline
    M Offline
    Marissa182
    wrote on last edited by
    #1

    can anyone tell me the proper way to disable and enable them within a dialog i know ive posted this thread 2 times already but neither asnwer worked thanks for any help

    A M T 3 Replies Last reply
    0
    • M Marissa182

      can anyone tell me the proper way to disable and enable them within a dialog i know ive posted this thread 2 times already but neither asnwer worked thanks for any help

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      send TB_SETBUTTONINFO with sendmessage... TBBUTTONINFO.fsState = TBSTATE_INDETERMINATE; Don't try it, just do it! ;-)

      M 1 Reply Last reply
      0
      • A Alexander M

        send TB_SETBUTTONINFO with sendmessage... TBBUTTONINFO.fsState = TBSTATE_INDETERMINATE; Don't try it, just do it! ;-)

        M Offline
        M Offline
        Marissa182
        wrote on last edited by
        #3

        and how do i send that to send message and how do i tell it wich buttons to disbale/enable?

        1 Reply Last reply
        0
        • M Marissa182

          can anyone tell me the proper way to disable and enable them within a dialog i know ive posted this thread 2 times already but neither asnwer worked thanks for any help

          M Offline
          M Offline
          Marissa182
          wrote on last edited by
          #4

          thats how its done if you tool bar control is a member of your dlg class m_Tool.SetButtonStyle(1, TBBS_DISABLED); m_Tool.SetButtonStyle(1, TBSTATE_ENABLED);

          1 Reply Last reply
          0
          • M Marissa182

            can anyone tell me the proper way to disable and enable them within a dialog i know ive posted this thread 2 times already but neither asnwer worked thanks for any help

            T Offline
            T Offline
            tmangan
            wrote on last edited by
            #5
            1. If you have a mapped variable for the dialog item: 1A) If it is a static item created with the visual editor: itemmappedvariable.EnableWindow(BOOL); 1B) If it is a dynamic item created on the fly: itemmappedvariable->EnableWindow(BOOL); where BOOL is TRUE or FALSE. Setting to FALSE makes the item greyed out and not selectable by the user, which is what most people mean by disabled. 2) If you want the dialog item to completely disapear, you use: 2A) itemmappedvariable.ShowWindow(var); 2B) itemmappedvariable->ShowWindow(var); where var=SW_SHOW to make it visible var=SW_HIDE to make it disapear. If you don't know what a mapped variable is, either: 1) Ggo to the item in the dialog editor. Click on the dialog item, Right click, select create variable. Fill in the name, hit OK. This makes all the coding changes so that you can use the A syntax above. If you search your dialog .h and .cpp you can see the simple changes and do others by hand. Pay attention to the lack of trailing semicolons if you do. 2) You can also use GetDlgItem(IDC_WHATEVER)->EnableWindow(BOOL) or GetDlgItem(IDC_whatever)->ShowWindow(var). Less efficient this way if you do it a lot. Good luck! tim Founder, TMurgent Technologies www.tmurgent.com tmangan@tmurgent.com
            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