COmbobox messages
Is there any way by which we can prohbit a ComboBox control so taht it cannot send CBN_SELENDCANCEL, CBN_CLOSEUP messages
[122 byte] By [
myaman] at [2007-11-18 20:34:17]

# 1 Re: COmbobox messages
In short i dont want the list box associated with the combobox to be displayed and i dont want the combobox to send any messages associated with the dropping down of the combobox
myaman at 2007-11-11 1:12:22 >

# 2 Re: COmbobox messages
well, what you want to do (not to display the listbox of combo box) is possible - but you cannot suppress the notifications generated by the combobox.
In MFC when u want to customize the combo-box, u derive a new class of CComboBox, and override the notification handlers of ur interest in the derived class. So similarly, u can write your own handlers for the notifications like CBN_SELEENDCANCEL or whateever, and dont call the base class's default handler. This will stop the combo-box from following it's default behaviour.
Alternatively, u can override the PretranslateMsg function in MFC, and cut down the unwanted notifications then and their itself. I think this will be more suitable solution for ur problem
# 3 Re: COmbobox messages
my view is that if I will somehow stop that CBN_DROPDOWN message then CBN_SELENDCANCEL, CBN_CLOSEUP will not be generated Is that correct ?
myaman at 2007-11-11 1:14:14 >

# 4 Re: COmbobox messages
Originally posted by myaman
In short i dont want the list box associated with the combobox to be displayed and i dont want the combobox to send any messages associated with the dropping down of the combobox
Is it a drop down list ? And when you say you don't want the list to be displayed, what is the user going to do with such a combo box ? It is as good as a edit control , right ?
# 5 Re: COmbobox messages
no frend the reqmnt is different
actually we were interestes in a multi select combobox, so for that we are showing a list view just below the combobox to the user whenever user clicks on the combobox, so that he can multiselect from the list view..............but in this case the default behaviour of combobox is creating problems
myaman at 2007-11-11 1:16:17 >

# 6 Re: COmbobox messages
Probably in that case, combo box is not a suitable option for you. Did you try other options ? Did you look at articles here in CG if there is some control that will suit your requirements ?
# 7 Re: COmbobox messages
what can be the other option as per u.
myaman at 2007-11-11 1:18:22 >

# 8 Re: COmbobox messages
1. Did you check CG articles... ?
2. A child dialog, with an edit, button and a list box control.
# 9 Re: COmbobox messages
can u give me more about the approach which u r telling or give me some URL where i can read
myaman at 2007-11-11 1:20:27 >

# 10 Re: COmbobox messages
Go to www.dev-archive.com.
On the left side navigation bar, you will see Visual C++/C++, when you hover your mouse on that you get a menu, hover mouse on controls, you will come up with a list of controls. Select the proper one and check out the articles.
# 11 Re: COmbobox messages
thanks again
u see that i m trying in the pretranslatemessage the following things
if(pMsg->message == WM_COMMAND)
if(LOWORD(pMsg->wParam) == ID_OF_COMBO)
if ( HIWORD(pMsg->wParam) )
return FALSE;
I m returning false so that this message is not handled.
i am putting break point on the second line but even the clicking on the combobox is not taking me to taht breakpoint
myaman at 2007-11-11 1:22:32 >
