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. Combo box window text

Combo box window text

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • G Offline
    G Offline
    gokings
    wrote on last edited by
    #1

    Hello, I wish to have a combo box for which the window text is always the same. For example, the text of the combo box is "Select Widget". When the drop down button is clicked, a list of widgets should appear; after a widget is selected, the combo box should once again show the text "Select Widget", rather than displaying the selected widget. I have tried simply using SetWindowText on the CComboBox object, but that did not work. Might anyone have a bit of sample code doing this? Thanks

    R R 2 Replies Last reply
    0
    • G gokings

      Hello, I wish to have a combo box for which the window text is always the same. For example, the text of the combo box is "Select Widget". When the drop down button is clicked, a list of widgets should appear; after a widget is selected, the combo box should once again show the text "Select Widget", rather than displaying the selected widget. I have tried simply using SetWindowText on the CComboBox object, but that did not work. Might anyone have a bit of sample code doing this? Thanks

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

      [Shameless plug] You might want to consider using a FooButton[^] whose caption is "Select Widget". When the button is clicked, display your widget selection menu as described in the section "Displaying a popup menu". /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

      G 1 Reply Last reply
      0
      • G gokings

        Hello, I wish to have a combo box for which the window text is always the same. For example, the text of the combo box is "Select Widget". When the drop down button is clicked, a list of widgets should appear; after a widget is selected, the combo box should once again show the text "Select Widget", rather than displaying the selected widget. I have tried simply using SetWindowText on the CComboBox object, but that did not work. Might anyone have a bit of sample code doing this? Thanks

        R Offline
        R Offline
        RChin
        wrote on last edited by
        #3

        The combo box sends a change event message whenever someone makes a selection. If you override this message, you can then (a). handle that selection, then... (b) reset the selection to the 'Select Widget' text. Have a look at the various event messages sent from the class wizard to override.


        I Dream of Absolute Zero

        G 1 Reply Last reply
        0
        • R Ravi Bhavnani

          [Shameless plug] You might want to consider using a FooButton[^] whose caption is "Select Widget". When the button is clicked, display your widget selection menu as described in the section "Displaying a popup menu". /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

          G Offline
          G Offline
          gokings
          wrote on last edited by
          #4

          I may recode it to do just that if I am unable to get the combo box to work. Using the FooButton is slightly more complicated for me as the button would be on a toolbar and I would need to call Create() for it myself. I appreciate the input.

          1 Reply Last reply
          0
          • R RChin

            The combo box sends a change event message whenever someone makes a selection. If you override this message, you can then (a). handle that selection, then... (b) reset the selection to the 'Select Widget' text. Have a look at the various event messages sent from the class wizard to override.


            I Dream of Absolute Zero

            G Offline
            G Offline
            gokings
            wrote on last edited by
            #5

            The problem is that I don't want a "Select Widget" selection to appear as a choice when the combo box drops down. Thanks for your input.

            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