CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85

    Dialog problem/questions

    I have a Modal dialog, Parent, and a button it that'll call a modeless dialog Child. I want to be able to have the Child dialog in the background and bring the Parent into the foreground with, say a Left mouseclick. I figured that since the Child dialog is modeless it can go behind the Parent no problem... but I cannot get it to work. I've tried this in the Parent OnLeftMouseClick...
    Code:
    this->SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW );
    b/c after reading the MSDN pages I thought this should work... how do I accomplish this? Thanks...

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    Modeless dialog is not really a child of one that spawned it. Modal owns modeless

    If you pass pointer to a desktop instead of this than modeless will stay on a top of desktop window.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  3. #3
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85
    Originally posted by JohnCz
    Modeless dialog is not really a child of one that spawned it. Modal owns modeless

    If you pass pointer to a desktop instead of this than modeless will stay on a top of desktop window.
    I probably wasn't clear but the Modal dialog is the Parent and the Child is Modeless... so shouldn't the Parent be able to be on top is one clicks on it? I don't want the Modeless Child dialog on top when it's not active.

  4. #4
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    Again: modeless is not a child in this scenario. Child window occupy parent’s client area and is contained to this area. Window has WS_CHILD style.

    Modeless dialog has popup or overlap style.

    Do this calling Create:
    Code:
    	m_dlg.Create(CModelessDlg::IDD, GetDesktopWindow());
    this will make desktop window owner of the modeless dialog.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  5. #5
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85
    Ohhh... gotcha! THanks!

  6. #6
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    You are welcome.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured