Click here to Skip to main content
15,905,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
If I choose an element of the DropDown type combo box, the ON_CBN_CLOSEUP() event handler is NOT called unless I select the element again. But when I change to DropDownList type, the ON_CBN_CLOSEUP() event handler is called the first time I select an element. Does anyone know why?
Sergey Alexandrovich Kryukov 7-Jul-11 1:24am    
You need to explain precisely, step-by-step what do you mean be "chose", "select" and "select again", perhaps in terms of mouse click and key presses. So far, it's not 100% clear; but in these matters every tiny detail counts.

Thank you.--SA
DrBones69 7-Jul-11 14:16pm    
If I click on the combo box to make it drop down showing me the elements and then click on one of the elements the combo drop down closes with that element displayed on the control and then nothing happens until I repeat this process. I assume this should call the oncloseup handler. But, that's not the case with the control set as a DropDown. If I change the control type of the combo box in the properties to a DropDownList the event handler (oncloseup) is called like I thought the dropdown would work.

1 solution

According to MSDN (reference), the ON_CBN_CLOSEUP message is not sent for a combo box that has the CBS_SIMPLE style. I think that is your problem. If you are using this setup on the combo box, then just use the ON_CBN_SELCHANGE event and you should get the event you need, that is unless you have a different reason for not using this one in the first place.
Share this answer
Espen Harlinn 7-Jul-11 21:14pm    
Nice reply, my 5
DrBones69 8-Jul-11 22:50pm    
There are only 3 selections in the properties for the combo box: Simple, Dropdown and Drop List. I wanted Dropdown, but the handlers aren't working like I would like. Upon further reading the CComboBox class documentation, we can not predict when the messages will be called. "NICE :( " I will keep banging my head against a hard surface until I figure it out...



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900