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. Iterate through all the controls on CFormView

Iterate through all the controls on CFormView

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 4 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.
  • A Offline
    A Offline
    Abebe
    wrote on last edited by
    #1

    I want to disable or enable all the controls on a form, but i don't want to use the classwizard to create control variables for each of them (since there are many controls). I've tried to disable the CFormView itself (EnableWindow), but that didn't work :(. Does anybody have any ideas? :confused: Thanks. :-D Er zit een korstje op mijn aars.

    J P R 3 Replies Last reply
    0
    • A Abebe

      I want to disable or enable all the controls on a form, but i don't want to use the classwizard to create control variables for each of them (since there are many controls). I've tried to disable the CFormView itself (EnableWindow), but that didn't work :(. Does anybody have any ideas? :confused: Thanks. :-D Er zit een korstje op mijn aars.

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      Its not the best way : Knowing their IDs you can call GetDlgItem( int nID )->EnableWindow (MODE) for each or if your resource file is correctly numbered you can do a loop and disable them. Hope it helps, Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      1 Reply Last reply
      0
      • A Abebe

        I want to disable or enable all the controls on a form, but i don't want to use the classwizard to create control variables for each of them (since there are many controls). I've tried to disable the CFormView itself (EnableWindow), but that didn't work :(. Does anybody have any ideas? :confused: Thanks. :-D Er zit een korstje op mijn aars.

        P Offline
        P Offline
        Prakash Nadar
        wrote on last edited by
        #3

        Create a array of UINT that you want to enable or disable in group. assign each element of the array the value of the item id as a example UINT uControls[10]; uControls[0] = IDC_STATIC; uControls[0] = IDC_BUTTON1; etc then when you want to enable or disable; for(int i =0;i<10;i++) { GetDlgItem(uContorols[i])->EnableWindow(TRUE or FALSE); } Hope this helpes. My God is more powerfull Than Your God. (the line that divides the world)

        A 1 Reply Last reply
        0
        • A Abebe

          I want to disable or enable all the controls on a form, but i don't want to use the classwizard to create control variables for each of them (since there are many controls). I've tried to disable the CFormView itself (EnableWindow), but that didn't work :(. Does anybody have any ideas? :confused: Thanks. :-D Er zit een korstje op mijn aars.

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #4

          See EnumChildWindows(). /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com

          A 2 Replies Last reply
          0
          • P Prakash Nadar

            Create a array of UINT that you want to enable or disable in group. assign each element of the array the value of the item id as a example UINT uControls[10]; uControls[0] = IDC_STATIC; uControls[0] = IDC_BUTTON1; etc then when you want to enable or disable; for(int i =0;i<10;i++) { GetDlgItem(uContorols[i])->EnableWindow(TRUE or FALSE); } Hope this helpes. My God is more powerfull Than Your God. (the line that divides the world)

            A Offline
            A Offline
            Abebe
            wrote on last edited by
            #5

            That's not exactly what i'm looking for since i have to no the ID of my controls, which means that any modifications made to the interface (i.e. new button or labels), will result in code changes and that's not what i want. Er zit een korstje op mijn aars.

            1 Reply Last reply
            0
            • R Ravi Bhavnani

              See EnumChildWindows(). /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com

              A Offline
              A Offline
              Abebe
              wrote on last edited by
              #6

              that looks like it might be it, i'll try it out right away...thanks! Er zit een korstje op mijn aars.

              1 Reply Last reply
              0
              • R Ravi Bhavnani

                See EnumChildWindows(). /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com

                A Offline
                A Offline
                Abebe
                wrote on last edited by
                #7

                that did the trick...thanks again! Er zit een korstje op mijn aars.

                R 1 Reply Last reply
                0
                • A Abebe

                  that did the trick...thanks again! Er zit een korstje op mijn aars.

                  R Offline
                  R Offline
                  Ravi Bhavnani
                  wrote on last edited by
                  #8

                  You're welcome! Glad you're up and running! /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.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