I create a list box as a popup window with parent as NONE and display it below a combo box. (This is imitation of intellisearch IE or IAutoComplete in WTL) The creation of the listbox looks like this CMyComboBox::CreateListbox() { BOOL bRet = _list.CreateEx(0, _T("ComboLBox"), _T(""), WS_POPUP | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_NOTIFY, clientRect.left, clientRect.top, clientRect.Width(), clientRect.Height(), this->GetSafeHwnd(), //this is the combobox control's hwnd// NULL, NULL); }
I display this listbox when user starts typing some text in the combobox. I add the filtered strings as per the text to this listbox. There are two problems 1. I am trapping all the messages send to Listbox in its windowproc. I find that the first time I display this listbox, I am able to see LBN_SELCHANGE (or other listbox specific messages) being trapped in Windowproc. But they are sent only once. The next time when I try to change any selection, LBN_SELCHANGE is not sent/trapped (I don't know where this message goes). Although the basic messages - LBUTTON_DOWN/UP, KEY_DOWN/UP are being sent to the Listbox. I intend to write something like below, but LBN_SELCHANGE is caught only once. LRESULT CAutoCompListBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case LBN_SELCHANGE: { //Send this message to the combobox with the selected text // as argument }break;
Does the question make sense? or its too vague? :~ 2. I need to find a decent way to send the listbox messages to the combobox. Since the combobox is not at all related to Listbox here, I may have to resort to registering a callback in the Listbox to handle the messages. Is there any other way to handle the messages? Thanks first of all for reading the question. Many many thanks if you got some answers
Evil triumphs when good people sit quiet...