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. c++ combo list box

c++ combo list box

Scheduled Pinned Locked Moved C / C++ / MFC
c++
10 Posts 2 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
    mrby123
    wrote on last edited by
    #1

    Hi, I am trying to add a combo box to provide a list of choice to the user. I add it to a dialogue box and entered Listbox items, but when I try to run to see the list, it is not there. I guess I need more work to make it work for me. Please direct me Thanks

    D 1 Reply Last reply
    0
    • M mrby123

      Hi, I am trying to add a combo box to provide a list of choice to the user. I add it to a dialogue box and entered Listbox items, but when I try to run to see the list, it is not there. I guess I need more work to make it work for me. Please direct me Thanks

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

      mrby123 wrote:

      ...and entered Listbox items...

      How?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "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

      "Man who follows car will be exhausted." - Confucius

      M 1 Reply Last reply
      0
      • D David Crow

        mrby123 wrote:

        ...and entered Listbox items...

        How?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "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

        "Man who follows car will be exhausted." - Confucius

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

        By right click the combo box image -> property->Data tab to do Enter ListBox Items Thanks

        D 1 Reply Last reply
        0
        • M mrby123

          By right click the combo box image -> property->Data tab to do Enter ListBox Items Thanks

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

          You need to size the control by clicking on its down-arrow and draging the control to the desired height.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "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

          "Man who follows car will be exhausted." - Confucius

          M 1 Reply Last reply
          0
          • D David Crow

            You need to size the control by clicking on its down-arrow and draging the control to the desired height.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "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

            "Man who follows car will be exhausted." - Confucius

            M Offline
            M Offline
            mrby123
            wrote on last edited by
            #5

            I got the combo box working. I can select an item and retrieve the value. However, the combo box is empty by default if the user does not select an item. How to set an default value if the user does not or forget to select a value? Thanks

            D 1 Reply Last reply
            0
            • M mrby123

              I got the combo box working. I can select an item and retrieve the value. However, the combo box is empty by default if the user does not select an item. How to set an default value if the user does not or forget to select a value? Thanks

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

              Use SetWindowText() or SetCurSel().

              "One man's wage rise is another man's price increase." - Harold Wilson

              "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

              "Man who follows car will be exhausted." - Confucius

              M 1 Reply Last reply
              0
              • D David Crow

                Use SetWindowText() or SetCurSel().

                "One man's wage rise is another man's price increase." - Harold Wilson

                "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

                "Man who follows car will be exhausted." - Confucius

                M Offline
                M Offline
                mrby123
                wrote on last edited by
                #7

                Thanks. That works. In the simple application I have two dialogue box. One is for input and the other for display results. I use Edit box to display results of calculated numbers (float or int). Then each edit box have a tittle above it by Static Text. Ideally I can change the static text according to the input since this static text should show the unit of the displayed numbers. The unit depends on the input selection of the units. How to change the static text on fly by the application according to the input selection from the input combo box. Thanks a lot

                D 1 Reply Last reply
                0
                • M mrby123

                  Thanks. That works. In the simple application I have two dialogue box. One is for input and the other for display results. I use Edit box to display results of calculated numbers (float or int). Then each edit box have a tittle above it by Static Text. Ideally I can change the static text according to the input since this static text should show the unit of the displayed numbers. The unit depends on the input selection of the units. How to change the static text on fly by the application according to the input selection from the input combo box. Thanks a lot

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

                  mrby123 wrote:

                  How to change the static text on fly by the application...

                  Use SetWindowText().

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "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

                  "Man who follows car will be exhausted." - Confucius

                  M 1 Reply Last reply
                  0
                  • D David Crow

                    mrby123 wrote:

                    How to change the static text on fly by the application...

                    Use SetWindowText().

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "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

                    "Man who follows car will be exhausted." - Confucius

                    M Offline
                    M Offline
                    mrby123
                    wrote on last edited by
                    #9

                    m_pv_unit is declared in the header file of Class A: CString m_pv_unit; which is assigned value from Combo Box. Class B is the for the output display. Class B includes the header file of Class A. However, I tried to use the variable: m_pv_unit to change the static text (the tittle of the output edit box), I got error message from the compile: 'm_pv_unit' : undeclared identifier How to make: m_pv_unit to be see in Class B ? Or how to pass the variable: m_pv_unit and its value in Class A to methods in Class B. Class B (its methods) is called by Class A. The method of Class B displays the results processed by Class A. Thanks

                    modified on Friday, May 21, 2010 1:02 AM

                    D 1 Reply Last reply
                    0
                    • M mrby123

                      m_pv_unit is declared in the header file of Class A: CString m_pv_unit; which is assigned value from Combo Box. Class B is the for the output display. Class B includes the header file of Class A. However, I tried to use the variable: m_pv_unit to change the static text (the tittle of the output edit box), I got error message from the compile: 'm_pv_unit' : undeclared identifier How to make: m_pv_unit to be see in Class B ? Or how to pass the variable: m_pv_unit and its value in Class A to methods in Class B. Class B (its methods) is called by Class A. The method of Class B displays the results processed by Class A. Thanks

                      modified on Friday, May 21, 2010 1:02 AM

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

                      mrby123 wrote:

                      m_pv_unit is declared in the header file of Class A: CString m_pv_unit; which is assigned value from Combo Box.

                      I suggest using CComboBox object instead.

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "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

                      "Man who follows car will be exhausted." - Confucius

                      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