• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 666
  • Last Modified:

Combo box will not drop down in VS2005 MFC Dll

I have an MFC Dll created in VS2005.  In this dll, I have a dialog (CDialog) that has a few controls, including a combo box.

In the resource editor, I've dragged (expanded out) the list portion of the combo box to about an inch tall, so it can display several combo items when selected.  I then set the style to "Drop List".  At run time, I populate the combo box with several strings.  However, when I click the combo box's arrow, it doesn't spawn the drop list.  Instead, I only see the currently selected combo item.  I have already tested at runtime to ensure there are several combo items in the combo box, using myComboBox.GetCount().  There are 4 combo items as I expect there to be.  I've put a debugger stop in the message handler that handles the ON_CBN_SELCHANGE message.  However, this message handler NEVER GETS CALLED. I'm sure this is a big clue as to what's going on.  I've also (in an attempt to debug) handle the set focus message for the combo box. This message handler DOES get called.  So I know that the debugger is recognizing my combo box control variable myComboBox.

Not sure if this is issue is directly related to the MFC dll, or whether it might also exist in a 2005 MFC application.

By the way, the combo box is on a basic dialog (derived from CDialog).  Nothing fancy going on there.

Any help would be greatly appreciated.
  • 2
1 Solution
In the dialog editor, check the size of the drop-down.

If you click in the text portion of the combo, you will get an outline of the control.  But if you click on the down arrow, you will get an outline of the size of the control when the drop-down list pops up.
to add to above comment:

it is somewhat unexpected what HooKooDooKu explained about design of a combobox with the resource editor where you have two different rectangles for size depending on the position in the control you do the mouse click. but that "feature" already came with the very first "apstudio" of the vc compiler in 1993.

if you look in the .rc file you have only coordinates for one rectangle for the combobox. that works cause when you click to the edit part of the combobox you only can change the width and when clicking to the down arrow you only can change the height. that means you can't design a different edit height when using the resource editor (though that is possible programmatically for example by calling MoveWindow).


cjm20Author Commented:
Thanks Sara!!!!.  I've always shy-ed away from manually editing the .rc file, but in this case, it was necessary for me to modify the combo box height in the .rc file, because simply expanding the combo box in the resource editor was NOT making the combo box reflect this height at runtime.  I checked the .rc file, and despite my efforts to increase the height of the combo box, the .rc file kept listing the combo height as "13".

 Normally, to create the list height for the combo box, I set the combo box "Style" property to "Simple", and then " manually "drag" the combo box's "list portion" down about an inch, so that at runtime, about 1 inch worth of combo items can be seen.  Then, after dragging the height to about an inch, I then change the "Style" property of the combo box again to "Drop List".  This technique had worked 100% of the time in the past, in numerous applications, in VC6, VS2005, and VS2010.  However, this technique did NOT work in VS2005 with an MFC Dll.

 Thus, I modified the height of the combo box manually in the .rc file, changing it from 13 to 63.  Problem solved.
good job :)

you might delete the *.aps file (same name as project and rc file) and try again to do the change within the resource editor. the .aps file is a binary equivalent of the .rc file (will be created again after you deleted it) and unfortunately it overrules some times changes you made in rc. it is well possible that the problems you had, came from .aps file.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now