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. combobox selection problem - stuck, wrong, etc.

combobox selection problem - stuck, wrong, etc.

Scheduled Pinned Locked Moved C / C++ / MFC
helpwpfquestion
4 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.
  • P Offline
    P Offline
    permutations
    wrote on last edited by
    #1

    I really hope someone can offer some suggestions on this because I'm going bonkers here. I've spent days trying to hunt down this problem and I can't find it. I have two combo boxes that are populated from atlas data. The first is a list of US states and countries. Once that selection is made, the second combo box is populated with a list of the cities in the selected state or country. The code for the two is line-for-line identical - or as identical as it can be except for adding different strings. The combo box styles are identical, the event handling is identical. But one works (the state/country selection) and one has problems (the city selection). In the state/country combo box, you can press the down arrow and move through the items. In the city combo box, the selection won't move with the arrow - or rather, it appears not to move. If you accept a selection and close the dialog, you find that the selection actually did change. You only can move one position with the arrow, and only the first time you try it. After that it appears stuck. Also, when you make a selection with the mouse in the city combo box, you don't get what you select. You get a selection a few items off. The mouse selection works fine in the state/country combo box. I have been over this code a million times and I can't see why one works and the other does not. Does anyone have any idea what the problem might be? Thanks in advance.

    P 1 Reply Last reply
    0
    • P permutations

      I really hope someone can offer some suggestions on this because I'm going bonkers here. I've spent days trying to hunt down this problem and I can't find it. I have two combo boxes that are populated from atlas data. The first is a list of US states and countries. Once that selection is made, the second combo box is populated with a list of the cities in the selected state or country. The code for the two is line-for-line identical - or as identical as it can be except for adding different strings. The combo box styles are identical, the event handling is identical. But one works (the state/country selection) and one has problems (the city selection). In the state/country combo box, you can press the down arrow and move through the items. In the city combo box, the selection won't move with the arrow - or rather, it appears not to move. If you accept a selection and close the dialog, you find that the selection actually did change. You only can move one position with the arrow, and only the first time you try it. After that it appears stuck. Also, when you make a selection with the mouse in the city combo box, you don't get what you select. You get a selection a few items off. The mouse selection works fine in the state/country combo box. I have been over this code a million times and I can't see why one works and the other does not. Does anyone have any idea what the problem might be? Thanks in advance.

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #2

      Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like ComboBox1 and ComboBox2 almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)

      Software rusts. Simon Stephenson, ca 1994.

      P 2 Replies Last reply
      0
      • P Peter_in_2780

        Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like ComboBox1 and ComboBox2 almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)

        Software rusts. Simon Stephenson, ca 1994.

        P Offline
        P Offline
        permutations
        wrote on last edited by
        #3

        It's not practical to post the code. It's a long, complicated program. My next move will be to try to reproduce it in a test program. Maybe that will help. I was hoping someone here would have an idea of what could even cause this kind of selection problem in a combo box. I have no idea.

        1 Reply Last reply
        0
        • P Peter_in_2780

          Just a thought. If you made the "line-by-line identical" bits by cut/paste/edit, maybe you missed one combobox reference in the edit part. Very easy to do and difficult to see[1], particularly if the names are similar (using something like ComboBox1 and ComboBox2 almost guarantees a problem). [1] Difficult to see yourself that is, but often sticks out like dogs' ****s to someone else! :)

          Software rusts. Simon Stephenson, ca 1994.

          P Offline
          P Offline
          permutations
          wrote on last edited by
          #4

          I found the answer in an article on Newcomer's site: http://www.flounder.com/updatedata.htm I went through my program and commented out all instances of UpdateData(). Voila – problem gone. I may need to clean up a few problems using the control variables, but the problem that’s been driving me insane is solved. The cursor is unstuck.

          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