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. Dynamic Loading Of Portions of Controls(List Boxes, List Controls, Edit Boxes) in a Dialog

Dynamic Loading Of Portions of Controls(List Boxes, List Controls, Edit Boxes) in a Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++
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.
  • L Offline
    L Offline
    Larry Mills Sr
    wrote on last edited by
    #1

    Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.

    A C++ programming language novice, but striving to learn

    CPalliniC _ D 3 Replies Last reply
    0
    • L Larry Mills Sr

      Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.

      A C++ programming language novice, but striving to learn

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      CreateWindow [^] function is the key to your success. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • L Larry Mills Sr

        Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.

        A C++ programming language novice, but striving to learn

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        You can either place all the controls that you will ever be using in the dialog template and hide/show them as required or use the CreateWindow[^] API with the predefined class names as described in the remarks section.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        L 1 Reply Last reply
        0
        • _ _Superman_

          You can either place all the controls that you will ever be using in the dialog template and hide/show them as required or use the CreateWindow[^] API with the predefined class names as described in the remarks section.

          «_Superman_» I love work. It gives me something to do between weekends.
          Microsoft MVP (Visual C++)

          L Offline
          L Offline
          Larry Mills Sr
          wrote on last edited by
          #4

          I understand what you are saying, I think.   Ex. one useage requires a large listbox while another selection would require a large editbox. You are saying that while the dialog is displayed? I can change what is presented?   Or must I close the dialog after the User made a selection and then reload it with the proper controls in place according to the User's previous selections?

          A C++ programming language novice, but striving to learn

          _ 1 Reply Last reply
          0
          • L Larry Mills Sr

            I understand what you are saying, I think.   Ex. one useage requires a large listbox while another selection would require a large editbox. You are saying that while the dialog is displayed? I can change what is presented?   Or must I close the dialog after the User made a selection and then reload it with the proper controls in place according to the User's previous selections?

            A C++ programming language novice, but striving to learn

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            Yes, you can change what is displayed on the dialog without closing and reopening. For example - The following will hide the list box and show the edit box.

            GetDlgItem(IDC_LIST1)->ShowWindow(SW_HIDE);
            GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);

            «_Superman_» I love work. It gives me something to do between weekends.
            Microsoft MVP (Visual C++)

            L 1 Reply Last reply
            0
            • _ _Superman_

              Yes, you can change what is displayed on the dialog without closing and reopening. For example - The following will hide the list box and show the edit box.

              GetDlgItem(IDC_LIST1)->ShowWindow(SW_HIDE);
              GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);

              «_Superman_» I love work. It gives me something to do between weekends.
              Microsoft MVP (Visual C++)

              L Offline
              L Offline
              Larry Mills Sr
              wrote on last edited by
              #6

              Thank you so much for your help.   This really sovles my situation.

              A C++ programming language novice, but striving to learn

              1 Reply Last reply
              0
              • L Larry Mills Sr

                Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.

                A C++ programming language novice, but striving to learn

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                I find the best way to handle this is to create all of the controls you'll need and then just enable/disable them at runtime.

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                L 1 Reply Last reply
                0
                • D David Crow

                  I find the best way to handle this is to create all of the controls you'll need and then just enable/disable them at runtime.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  L Offline
                  L Offline
                  Larry Mills Sr
                  wrote on last edited by
                  #8

                  Thanks again for the information.

                  A C++ programming language novice, but striving to learn

                  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