Combo box not showing pull down list
-
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.
-
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.
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
-
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.
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++"
-
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++"
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