Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

How to set the parent dialog??

$
0
0
Hi all,

I’ve created a modeless dialog from my main dialog as follows:

Code:

m_pContainerDlg = new CDlgContainer(NULL, this);
m_pContainerDlg->Create(CDlgContainer::IDD, GetDesktopWindow());
m_pContainerDlg ->ShowWindow(SW_SHOW);

This container dialog creates a child dialog which I show inside the container

Code:

BOOL CDlgContainer::OnInitDialog()
{
    // Create the child dialog and show it
    m_pChildDlg = new CChildDlg(this);
    m_pChildDlg->Create(IDD_DIRECTORY_DIALOG, this);

    return FALSE;
}

From my child dialog I then create a modal dialog when a user clicks on a button

Code:

CChildDlg:: CChildDlg (CWnd* pParent /*=NULL*/)  :
        m_pParent((CDlgContainer*)pParent),
{
}

void CChildDlg::OnBnClickedBtn()
{
    CMyDlg MyDlg;
    INT_PTR iResult = MyDlg.DoModal(pParent);
}

My problem is that the CMyDlg is modal but to the main dialog and not to the container or the child dialog.

Can anyone please advise??

Viewing all articles
Browse latest Browse all 3042

Trending Articles