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 not showing pull down list

Combo box not showing pull down list

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 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.
  • R Offline
    R Offline
    rmnowick
    wrote on last edited by
    #1

    All, I have created a combo box from the same set of parameters used to create a previous combo box. I hace verified that they have the same properties. Here are the properties. All "False" except where noted: Data: empty box ID: IDC_TRIGGERING Owner Draw: No Tabstop: True Type: Drop List Vertical Scrollbar: True Visible: True The idea is that I wish to present the user with a fixed list of values to choose from. The code to add items to the list is as follows:

    nTriggerMode = GetPrivateProfileInt("Settings", "Triggering Mode", 0, "sdkdemo.ini");
    lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"10");
    lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"15");
    SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"20");
    SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_SETCURSEL, nTriggerMode, 0);

    The lResult variable is being incremented as the numbers are being added to the combo box, so that appears to be working. The value of nTriggerMode is pulled out of a file and whatever value it is set to initially (0, 1 or 2) successfully controls which of the three items is first shown in the display (10, 15 or 20). Life is good... Except, when I try and use the combo box by left clicking in the pulldown on the right of the box, nothing happens except that I get a narrow black line (1/16 inch) that appears under the combo box. The line then disappears when I click the pulldown again. The list of 3 items never appears. I don't believe that I need to process messages for the combo box. The other application didn't. When I want to know what value the user has most recently entered I just do the following:

    nTriggerMode = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_GETCURSEL, 0, 0);

    Any ideas? Robert P.S. I am not using MFC in this code.

    C P 2 Replies Last reply
    0
    • R rmnowick

      All, I have created a combo box from the same set of parameters used to create a previous combo box. I hace verified that they have the same properties. Here are the properties. All "False" except where noted: Data: empty box ID: IDC_TRIGGERING Owner Draw: No Tabstop: True Type: Drop List Vertical Scrollbar: True Visible: True The idea is that I wish to present the user with a fixed list of values to choose from. The code to add items to the list is as follows:

      nTriggerMode = GetPrivateProfileInt("Settings", "Triggering Mode", 0, "sdkdemo.ini");
      lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"10");
      lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"15");
      SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"20");
      SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_SETCURSEL, nTriggerMode, 0);

      The lResult variable is being incremented as the numbers are being added to the combo box, so that appears to be working. The value of nTriggerMode is pulled out of a file and whatever value it is set to initially (0, 1 or 2) successfully controls which of the three items is first shown in the display (10, 15 or 20). Life is good... Except, when I try and use the combo box by left clicking in the pulldown on the right of the box, nothing happens except that I get a narrow black line (1/16 inch) that appears under the combo box. The line then disappears when I click the pulldown again. The list of 3 items never appears. I don't believe that I need to process messages for the combo box. The other application didn't. When I want to know what value the user has most recently entered I just do the following:

      nTriggerMode = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_GETCURSEL, 0, 0);

      Any ideas? Robert P.S. I am not using MFC in this code.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You need to set the size of the drop down list, for some idiotic reason it defaults to this zero value. At least, that's what happens when designing the dialog box using MFC. I have no idea how to do it in Win32, or even programatically, I always did it in the form designer. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      1 Reply Last reply
      0
      • R rmnowick

        All, I have created a combo box from the same set of parameters used to create a previous combo box. I hace verified that they have the same properties. Here are the properties. All "False" except where noted: Data: empty box ID: IDC_TRIGGERING Owner Draw: No Tabstop: True Type: Drop List Vertical Scrollbar: True Visible: True The idea is that I wish to present the user with a fixed list of values to choose from. The code to add items to the list is as follows:

        nTriggerMode = GetPrivateProfileInt("Settings", "Triggering Mode", 0, "sdkdemo.ini");
        lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"10");
        lResult = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"15");
        SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_ADDSTRING, 0, (long)"20");
        SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_SETCURSEL, nTriggerMode, 0);

        The lResult variable is being incremented as the numbers are being added to the combo box, so that appears to be working. The value of nTriggerMode is pulled out of a file and whatever value it is set to initially (0, 1 or 2) successfully controls which of the three items is first shown in the display (10, 15 or 20). Life is good... Except, when I try and use the combo box by left clicking in the pulldown on the right of the box, nothing happens except that I get a narrow black line (1/16 inch) that appears under the combo box. The line then disappears when I click the pulldown again. The list of 3 items never appears. I don't believe that I need to process messages for the combo box. The other application didn't. When I want to know what value the user has most recently entered I just do the following:

        nTriggerMode = SendMessage(GetDlgItem(hdlg, IDC_TRIGGERING), CB_GETCURSEL, 0, 0);

        Any ideas? Robert P.S. I am not using MFC in this code.

        P Offline
        P Offline
        Prakash Nadar
        wrote on last edited by
        #3

        Setting the size of the combo box is bit tricky if you havent done it before... by default you can only resize horizontally... ifyou want to do vertical resizing click on the arrow key and then you can resize vertically.... (all this in form design view).


        MSN Messenger. prakashnadar@msn.com Tip of the day of visual C++ IDE. "We use it before you do! Visual C++ was developed using Visual C++"

        R 1 Reply Last reply
        0
        • P Prakash Nadar

          Setting the size of the combo box is bit tricky if you havent done it before... by default you can only resize horizontally... ifyou want to do vertical resizing click on the arrow key and then you can resize vertically.... (all this in form design view).


          MSN Messenger. prakashnadar@msn.com Tip of the day of visual C++ IDE. "We use it before you do! Visual C++ was developed using Visual C++"

          R Offline
          R Offline
          rmnowick
          wrote on last edited by
          #4

          Mr. Prakash, Thanks, I found a similar answer in another thread, from another Indian guy :) In the resource editor if you click in the middle of the combo box, blue squares appear on the left and right, allowing you to make the box wider or narrower. But, if you click on the pulldown itself, there is a single blue box in the bottom center. Grabbing that blue box and pulling it down defines what size the combo box is when initially displayed. Too bad they don't say anything about this in the help area... Actually, it is explained. It is under "Combo Boxes" then "sizing". Robert

          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