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. Child Dialog Box

Child Dialog Box

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 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
    mvworld
    wrote on last edited by
    #1

    If I have a main dialog box, and On the click of a button I want a child dialog box to appear...what do I do? I created a dialog box (with type child) and in the BNClicked method of the button I wrote. void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; ChildBox->DoModal(); } But the images of the Main and the Child dialog boxes got superimposed (and got mixed up) during runtime. So someone suggested the following, but it still does not work! void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; if(!::IsWindow(GetSafeHwnd())) ChildBox->Create(IDD_AJOUT, this); ChildBox->ShowWindow(SW_SHOW); } Please tell me how do I get my child dialog box to show properly?

    C 1 Reply Last reply
    0
    • M mvworld

      If I have a main dialog box, and On the click of a button I want a child dialog box to appear...what do I do? I created a dialog box (with type child) and in the BNClicked method of the button I wrote. void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; ChildBox->DoModal(); } But the images of the Main and the Child dialog boxes got superimposed (and got mixed up) during runtime. So someone suggested the following, but it still does not work! void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; if(!::IsWindow(GetSafeHwnd())) ChildBox->Create(IDD_AJOUT, this); ChildBox->ShowWindow(SW_SHOW); } Please tell me how do I get my child dialog box to show properly?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      That's because you made it a type child, which means embedded in it's parent as opposed to a seperate dialog box. The suggestion you got was idiotic - it creates a modeless dialog and assumes it deletes itself ( because it's a pointer it won't die when it goes out of scope, nor do you have the address to interact with it or clean it up ) Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

      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