Can we draw a child window outside the client area of the parent?
-
I am trying to implement "intellisearch" combo box like we have in IE. I create a separate list box and draw it below combo box when user starts typing in something. The Combo box has to be a parent of this list box. When I draw the list box using the Create method, it offcourse will try to draw the list box inside the client area of the combo box, and fails to do so. Can we draw a child window outside the client area of the parent?
bool CAutoCompComboBox::CreateListBox() { CRect clientRect(-1, -1, -1, -1); GetClientRect(&clientRect); // adjust the height to be like a list box BOOL bRet = _listFilter.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_STANDARD, clientRect, this, 1); // the window is created but not seen here. // however this code works, obviously because I give the parent as // dialog box which is holding the AutoCompComboBox control. _listFilter.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_STANDARD, clientRect, GetParent(), 1);
Thanks in advance.. MishaEvil triumphs when good people sit quiet...
-
I am trying to implement "intellisearch" combo box like we have in IE. I create a separate list box and draw it below combo box when user starts typing in something. The Combo box has to be a parent of this list box. When I draw the list box using the Create method, it offcourse will try to draw the list box inside the client area of the combo box, and fails to do so. Can we draw a child window outside the client area of the parent?
bool CAutoCompComboBox::CreateListBox() { CRect clientRect(-1, -1, -1, -1); GetClientRect(&clientRect); // adjust the height to be like a list box BOOL bRet = _listFilter.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_STANDARD, clientRect, this, 1); // the window is created but not seen here. // however this code works, obviously because I give the parent as // dialog box which is holding the AutoCompComboBox control. _listFilter.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_STANDARD, clientRect, GetParent(), 1);
Thanks in advance.. MishaEvil triumphs when good people sit quiet...
I would suggest using the listbox comes with combobox instead of creating a new listbox. CComboBox::ShowDropDown()[^]
-
I would suggest using the listbox comes with combobox instead of creating a new listbox. CComboBox::ShowDropDown()[^]
Thanks, Thats the problem. I don't want to subclass the list box which comes with CCombobox. I have to keep it separate. all ideas would be greatly appreciated.
Evil triumphs when good people sit quiet...
-
Thanks, Thats the problem. I don't want to subclass the list box which comes with CCombobox. I have to keep it separate. all ideas would be greatly appreciated.
Evil triumphs when good people sit quiet...
what about WS_POPUP style instead of WS_CHILD and position the popup window relative to combobox and send the messages to and fro between combo box and popup listbox. I think popup window is the best match as "intellisearch" kind of control pops up when some thing is typed and closes when out of focus from combobox.
-
what about WS_POPUP style instead of WS_CHILD and position the popup window relative to combobox and send the messages to and fro between combo box and popup listbox. I think popup window is the best match as "intellisearch" kind of control pops up when some thing is typed and closes when out of focus from combobox.
Thanks, that seems to work. the code looks like this:
ClientToScreen(&clientRect); BOOL bRet = _listFilter.CreateEx(0, _T("LISTBOX"), _T(""), WS_POPUP | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_NOTIFY , clientRect.left, clientRect.top, clientRect.Width(), clientRect.Height(), this->GetSafeHwnd(), NULL, NULL);
Evil triumphs when good people sit quiet...