Link to home
Start Free TrialLog in
Avatar of leogi
leogi

asked on

CComboBox won't dropdown choices

My app has several dialogs.

On one of them that has a lot of controls none of the combobox dropdown menus work. When in the Visual studio IDE (Visual studio vs. 2005) clicking on the little dropdown arrow typically allows you to enlarge the dropdown region and this is quite long and similar comboboxes with same attribute in other windows have similar dropdown region length. On the dialog where it doesn't work clicking on the dropdown only show an additional line under the control, as if the size was set to something ridiculiously small. Is ther a way to fix this programatically by setting the dropdown area to display a few items?

Thanks
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

In the resource editor select the combo box.  Now drag the vertical size down - this WILL fix it.

You are in reality showing the drop down list part (only show an additional line under the control) it is just only a couple of pixels high
Avatar of leogi
leogi

ASKER

No this isn't it. The vertical section has been been elongated and further resizing won't do anything. I know exactly what you're saying, I am NOT talking about the edit section of the combobox but indeed the vertical section.
The dialog has a lot of controls, and the application was first developed using Visusal studio vs. 6 and them migrated to Visual studio 2005.
There is an attribute in MFC CCombobox that I believe control that size. Just can't find what it is.
The behaviour you describe is EXACTLY that when the vertical height of the LIST portion is not set.  I am not talking about the edit portion of the combo.



0012.jpg
Pressed return too soon

0013.jpg
0014.jpg
Avatar of leogi

ASKER

Well

I do appreciate your effort in helping here.

Unfortunately even though the behavior I describe is also the same behavior one would see when the LIST portion size is not set, this is not the problem.

In other words we have two different problems exhibiting the same behavior: I know 99% of the time people who do see this behavior are able to fix it using your recommended solution, However this is not the case this time.

I really appreciate you taking the time to help though

Thanks again
Hmm.
Are you modifying the size/position of the combo in code?  If yes then check the height you set
Avatar of leogi

ASKER

o but i'd like to do just that, i.e changethat size programatically
It needs to be mentioned:  
The dropdown list will be very short if thee are few items in the list
You can add data to the list and then check its behavior all in the IDE Resource Editor.  In Properties of the combo, set the Data element to 1;2;3;4;5;6;7;8  Then press Ctrl+T to test the dialog (then drop down the combobox list)
About the only other thing it could be is that the bottom of the list is hidden by some other control.
>>o but i'd like to do just that, i.e changethat size programatically

MoveWindow or SetWindowPos are used to change location and size of windows.  (The vertical size as I mentioned initially is the height of the complete control = edit + list)
A quick hack.
In resource editor change the ID of this dialog.
Add a new dialog.
Remove the default controls on it, size it to the size of the problem dialog - modify any other settings to match.
Change the ID to that of the problem dialog (original value).
Copy and paste all controls.
Build all - does it now work?

Avatar of leogi

ASKER

I will try

I have over 200 controls but I'll let you know
>>I have over 200 controls but I'll let you know

Select all / copy / paste

The whole should take only a minute or so, then rebuild all.
Avatar of leogi

ASKER

About half of those combo boxes work now

It seems that those that don't work are those that have other controls over them or nearby. Those controls are not visible unless the user clicks on a button to replace the control on the screen

So maybe the event handler can't display the list because it thinks the other control is displayed when it's not.

It may be that to make it work the combo boxes should be the last inserted using studio IDE.
Avatar of leogi

ASKER


actually I added a combo box that is nowhere other control and that one won't work either

There must be some maximum number of controls that can be added using visual studio. In VC98, I could not add new controls in that window, in visual studio 2005 I can but I am running into these problems.
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leogi

ASKER

yeah I hear you.

The dialog display is dynamically driven but the user, and for a programming point of view extremely complex. However making it tab driven should probably happen but would take more time and is beyond the current difficulty.

You would expect MFC to work or not but the odd behavior is what I seem to have to deal with nonetheless.
If you have over 200 controls on a dialogbox, you can expect strange behavior, but it is not a failing of MFC or Windows.   It is an issue of complexity.  With each new element, you create more ways for interaction to go awry.
Avatar of leogi

ASKER

Question is dropped because there hasn't been a single reason for these dropdown to stop working and they may have to do with the number of controls that have been added overtime. THe dialog will be rebuilt using a tab control which will alleviate the problem