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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with Combo boxes

Help with Combo boxes

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
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.
  • L Offline
    L Offline
    Luis E Cuadrado
    wrote on last edited by
    #1

    Hello: I need help with Combo boxes. I have a combo box in a dialog and I want to fill the combo box with some filenames of a specified directory. Then, after filling the combo box, I'm disabling it (it can be enable by a check box in the same dialog). The program complies and runs, and when I load the dialog with the combo box, when I click the check box to enable the combo box, there is nothing in it. This is the code snipet that I have in the ::OnInitDialog() event: ::SetCurrentDirectory(_T("C:\\sounds")); m_cbo.ResetContent(); m_cbo.Dir(DDL_DIRECTORY,_T("*.wav")); m_cbo.EnableWindow(FALSE); Is there something that I'm missing inthe combo box? What can I do to solve this? Any answer is more than welcome. Best regards, Luis E. Cuadrado :0)

    T M 2 Replies Last reply
    0
    • L Luis E Cuadrado

      Hello: I need help with Combo boxes. I have a combo box in a dialog and I want to fill the combo box with some filenames of a specified directory. Then, after filling the combo box, I'm disabling it (it can be enable by a check box in the same dialog). The program complies and runs, and when I load the dialog with the combo box, when I click the check box to enable the combo box, there is nothing in it. This is the code snipet that I have in the ::OnInitDialog() event: ::SetCurrentDirectory(_T("C:\\sounds")); m_cbo.ResetContent(); m_cbo.Dir(DDL_DIRECTORY,_T("*.wav")); m_cbo.EnableWindow(FALSE); Is there something that I'm missing inthe combo box? What can I do to solve this? Any answer is more than welcome. Best regards, Luis E. Cuadrado :0)

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Change DDL_DIRECTORY to DDL_READWRITE. Tomasz Sowinski -- http://www.shooltz.com

      What is "scratch" and why can everything be made from it?

      1 Reply Last reply
      0
      • L Luis E Cuadrado

        Hello: I need help with Combo boxes. I have a combo box in a dialog and I want to fill the combo box with some filenames of a specified directory. Then, after filling the combo box, I'm disabling it (it can be enable by a check box in the same dialog). The program complies and runs, and when I load the dialog with the combo box, when I click the check box to enable the combo box, there is nothing in it. This is the code snipet that I have in the ::OnInitDialog() event: ::SetCurrentDirectory(_T("C:\\sounds")); m_cbo.ResetContent(); m_cbo.Dir(DDL_DIRECTORY,_T("*.wav")); m_cbo.EnableWindow(FALSE); Is there something that I'm missing inthe combo box? What can I do to solve this? Any answer is more than welcome. Best regards, Luis E. Cuadrado :0)

        M Offline
        M Offline
        Mike Upton
        wrote on last edited by
        #3

        I've just looked at the sample code in the MSDN documentation, and it looks like you might need the DDL_READWRITE flag as well as the DDL_DIRECTORY flag:

        m_cbo.Dir(DDL_READWRITE | DDL_DIRECTORY, _T("*.wav"));

        I could be wrong though, I've never used CComboBox::Dir. If it still doesn't work, it might be worth checking the return value of the Dir function - it should be a positive value if everything's worked okay. If it returns zero, that means no files were added. A negative value indicates an error.


        "We are the knights who say Ni" (The Knights Who Say Ni)

        L 1 Reply Last reply
        0
        • M Mike Upton

          I've just looked at the sample code in the MSDN documentation, and it looks like you might need the DDL_READWRITE flag as well as the DDL_DIRECTORY flag:

          m_cbo.Dir(DDL_READWRITE | DDL_DIRECTORY, _T("*.wav"));

          I could be wrong though, I've never used CComboBox::Dir. If it still doesn't work, it might be worth checking the return value of the Dir function - it should be a positive value if everything's worked okay. If it returns zero, that means no files were added. A negative value indicates an error.


          "We are the knights who say Ni" (The Knights Who Say Ni)

          L Offline
          L Offline
          Luis E Cuadrado
          wrote on last edited by
          #4

          Hello again: I edit the code. I tried using DDL_READWRITE | DDL_DIRECTORY and using just DDL_DIRECTORY and I wasn't able to see any files in the combo box. I click the little arrow of the combo box and nothing comes down. I wonder if is something related with the combo box. Any property that I have to change or something. What do yo guys think? Thanks for the replies, Luis E. Luis E. Cuadrado :0)

          T 1 Reply Last reply
          0
          • L Luis E Cuadrado

            Hello again: I edit the code. I tried using DDL_READWRITE | DDL_DIRECTORY and using just DDL_DIRECTORY and I wasn't able to see any files in the combo box. I click the little arrow of the combo box and nothing comes down. I wonder if is something related with the combo box. Any property that I have to change or something. What do yo guys think? Thanks for the replies, Luis E. Luis E. Cuadrado :0)

            T Offline
            T Offline
            Tomasz Sowinski
            wrote on last edited by
            #5

            Your combo may have very small dropdown area. In the resource editor, click on the combo box arrow, then resize the dropdown rectangle. Tomasz Sowinski -- http://www.shooltz.com

            What is "scratch" and why can everything be made from it?

            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