Accessing a parent dialog's controls from a child modeless dialog 
Author Message
 Accessing a parent dialog's controls from a child modeless dialog

Hi Akin,

When you create you CSubDlg object do you pass the CMainDlg as the parent?
This can be accomplished like this:

void CMainDlg::OnMyHandler( void )
{
    // Create modeless dialogs from the heap.
    CSubDlg* dlg= new CSubDlg( this );
    // Display the dialog, only needed if the WS_VISIBLE style isn't set.
    dlg->ShowWindow( SW_NORMAL );

Quote:
}

then in the CSubDlg:

void CSubDlg::OnOK( void )
{
    // Depending on what functions you want to call, you may have to
typecast.
    // CWnd type functions can be called without typecasting.
    (GetParent()->GetDlgItem( IDC_EDIT ))->EnableWindow( true );
    ((CMainDlg*)GetParent())->DoMyFunction();
    if ( m_bModeless )
        DestroyWindow();
    else
        EndDialog( IDOK );

Quote:
}

HTH
--
===================
Frank Hickman
SecurTech, Inc.


===================



Wed, 08 Mar 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Modeless Dialog parent and child minmize problem.

2. Problem: React on Child-Dialog from Parent-Dialog

3. How do I derive a child dialog from parent dialog

4. Modeless Child Dialog of Modal Dialog

5. Child window of ActiveX control doesn't draw when control is moved in dialog

6. Dialog containing a CTabCtrl containing a modeless dialog box, shortcuts don't work

7. Access Control from child dialog box

8. who to control a main dialog by a child dialog

9. Modeless dialog as a parent??

10. Modeless Dialog in DLL, trying to pass calling APP as parent

11. Why is parent of modeless dialog *always* CMainFrame...

12. Modeless Dialog Always on Top of Parent

 

 
Powered by phpBB® Forum Software