mfc >> no list box for dropdown CComboBox

by Scott Starker » Tue, 25 Nov 2003 00:22:07 GMT


I'm using VC6 and MFC. I also have RichEdit. In a modeless dialog box
(Dialog Editor) I have 2 CComboBoxes. The program works fine but with this
exception: when I select the drop down arrow on either one of the
CComboBoxes I don't get the list box! (I call InitStorage(20, 30) on both
CComboBoxes.) How do I get a drop down list box when I select it with an
arrow? It's got to be something simple! (If I haven't given all the details
just let me know.)

Any help would be much appreciated.

Scott




mfc >> no list box for dropdown CComboBox

by CheckAbdoul » Tue, 25 Nov 2003 00:44:23 GMT


Select the combo box in the resource editor. Now click on the arrow
button portion of the combo box to bring up the drag handlers. Use the drag
handlers to increase the height of the combo box.

--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------



details





mfc >> no list box for dropdown CComboBox

by Scott Starker » Tue, 25 Nov 2003 00:58:00 GMT

Thank you very much! (See, I told you it would be easy!)



drag




no list box for dropdown CComboBox

by Joseph M. Newcomer » Tue, 25 Nov 2003 09:55:35 GMT

This is one of the most common questions. You didn't size the combo box to have a dropdown
area. Click on the dropdown arrow in the dialog editor and stretch it. Or better still,
download my SmartDropdown class from my MVP Tips site, which dyamically resizes the combo
box and attempts to eliminate the vertical scrollbar whenever possible.
joe




Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


no list box for dropdown CComboBox

by number 94 » Tue, 25 Nov 2003 10:37:16 GMT

Joseph.

I remember in one of my projects, I developed a CFormView application on
WinXP, and then when the executable is copied to a Win2000 PC, the calender
demonstrates abnormal behaviours, and that the combobox only drops down 1
line no matter how large I changed the dropdown area. Why is that so??

Regards



have a dropdown
better still,
resizes the combo

this
details




Similar Threads

1. CComboBox dropdown is only showing one item in dropdown list

I have a simple little CDialogImpl-derived class that has a dropdown-style 
ComboBox on it.  When I call AddString repeatedly, the actual dropdown size 
doesn't show all the items.  In fact, it only shows one and I have to use the 
scrollbar buttons to see the other items - it's almost like I have a spinner 
instead of a dropdown list.

The implementation is pretty straighforward - I derive from CDialogImpl in 
code and have a dropdown ComboBox in the resource file.   I use a CComboBox 
wrapper and do an Attach in the CDialogImpl-derived OnInitDialog method.  I 
can call AddString fine, but the dropdown size seems to be stuck at a single 
item height.

Does anyone have any suggestions?  Thanks in advance for any help.
-- 
Bob
Sr. Microsoft Architect
Lighthammer Software

2. CComboBox, dropdown list height

3. CComboBox - change dropdown/list styke at runtime

I've a dialog resource containing several combo-boxes, created with the 
CBS_DROPDOWNLIST style:
COMBOBOX        IDC_CMB_INPUT1,14,111,100,68,CBS_DROPDOWNLIST | 
                    WS_VSCROLL | WS_TABSTOP,0,HIDC_CMB_INPUT1

At runtime, I'd like to change some of these to CBS_DROPDOWN (to allow the 
user to add their own text) depending on the state of other things in the 
project.
In the property page's OnInitDialog(), I call:
CPropertyPage::OnInitDialog();
CComboBox* pCmb = static_cast<CComboBox*>(GetDlgItem(IDC_CMB_INPUT1));
pCmb->ModifyStyle(CBS_DROPDOWNLIST, CBS_DROPDOWN, TRUE);

I've verified that the style changes, and that ModifyStyle() returns TRUE, 
but the control remains a drop list. I'm guessing that OnInitDialog() is too 
late, as this part of the style cannot be redone (subclassing with Edit 
control??).

Thank you,

4. Change the size of the dropdown list in CComboBox

5. CComboBox problem (list box isn't shown)

Hello,

I use ComboBox in my dialog application. It is declared as follows:

    COMBOBOX        IDC_COMBO1,267,7,96,15,CBS_DROPDOWNLIST | WS_VSCROLL |
                    WS_TABSTOP | WS_CHILD

Then I use InsertString to add strings:

 int ind = 0;
CString tmp;
 while(!pComboRs->EndOfFile)
 {
  ComboStr *pCS = new ComboStr;
  pCS->kgor = (long)pComboRs->Fields->Item["kgor"]->Value;
  pCS->date = pComboRs->Fields->Item["datauz"]->Value;
  tmp.Format("%d", pCS->kgor);
  pTab6->m_combo.InsertString(ind, tmp);
  pTab6->m_combo.SetItemData(ind, (DWORD)pCS);
  ind++;
  pComboRs->MoveNext();
 }

When the dialog window is shown, I try to select items by clicking the
"arrow down" button of the combo box. But list box doesn't appear though I
can scroll through item list using keyboard with strings being shown in edit
box. So why is the list box empty?

Regards,
Vladimir.