Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can we draw a child window outside the client area of the parent?

Can we draw a child window outside the client area of the parent?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    misha_grewal
    wrote on last edited by
    #1

    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.. Misha

    Evil triumphs when good people sit quiet...

    R 1 Reply Last reply
    0
    • M misha_grewal

      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.. Misha

      Evil triumphs when good people sit quiet...

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      I would suggest using the listbox comes with combobox instead of creating a new listbox. CComboBox::ShowDropDown()[^]

      M 1 Reply Last reply
      0
      • R Rajkumar R

        I would suggest using the listbox comes with combobox instead of creating a new listbox. CComboBox::ShowDropDown()[^]

        M Offline
        M Offline
        misha_grewal
        wrote on last edited by
        #3

        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...

        R 1 Reply Last reply
        0
        • M misha_grewal

          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...

          R Offline
          R Offline
          Rajkumar R
          wrote on last edited by
          #4

          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.

          M 1 Reply Last reply
          0
          • R Rajkumar R

            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.

            M Offline
            M Offline
            misha_grewal
            wrote on last edited by
            #5

            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...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups