15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Embedding a CPropertySheet in a CDialog object.

Sieczka Mariusz -- sm@technodat.co.at
Monday, August 05, 1996


     Enviroment: VC++ 4.0 and Windows NT 3.51, Win32s

     Hi there!
     
     How can I embed a property sheet in a modal dialog box.
     (or more general: how to embed a dialog box in a dialog box)
     
     I tried to execute a Sample out of 'Kruglinsky - Inside Visual C++':
     example Ex087B but it didn't work!

	IT'S REALY IMPORTANT (NOT ONLY FOR ME!)

     Anybody who has some experience on this... please throw some light...
     thanks ...
-- 

                        ?:) Mariusz
         
-------------------------------------------------------------------
 Mariusz Sieczka                TECHNODAT GmbH.
 sm@technodat.co.at             CIMGRAPH  Product Development 
 Tel: +662/454944-123           A-5020 Salzburg
 Fax: +662/454944-9             Jakob-Haringerstrasse 6
-------------------------------------------------------------------



tomm@wrq.com
Friday, August 09, 1996

     Environment: VC++ 4.2,  NT 3.5
     
     // .Here is one way to embed a dialog in another dialog..
     //  I don't claim it's the best way but it works perfectly.
     
     //////////////////////////////////////////////////////////////////////
     ////////
     //
     // Function:     CBHODlg::OnInitDialog()
     //
     // Description:  embed a dialog box as a 'control' to hold a sub-table
     //
     // Returns:      BOOL.
     //
     //////////////////////////////////////////////////////////////////////
     ////////
     
     BOOL CBHODlg::OnInitDialog()
     {
     CDialog::OnInitDialog();
     
     // .position the sub-table dialog and display it
     
     CRect rectAnchor;
     CRect rectSubTable;
     
     // .NOTE: when you create the sub-table dialog resource, 
     //        make certain it has a style of 'child'
     //        otherwise, the following code will not position 
     //        the sub-table dialog correctly.
     //        (m_dlgSubTable is an instance of your embedded dialog class)
           
     m_dlgSubTable.Create(IDD_DIALOG_HOST_OS_VERSION, this);
     
     // . an invisible, disabled edit control made as small as possible
     //   on the parent dialog is used to 'anchor' the location of the 
     //   top left corner of the sub-table dialog.
     //
     //   there are probably better ways to do this.. but I found this
     //   method makes it simple to quickly make tiny adjustments to
     //   the embedded control's position
     
     CWnd* pWnd = GetDlgItem(IDC_EDIT_ANCHOR);
     
     // .GetWindowRect() returns screen coordinates of 'anchor' control
     
     pWnd->GetWindowRect(&rectAnchor);
     
     // .convert the screen coordinates to client coordinates for the 
     subsequent
     //  call to MoveWindow()
     
     ScreenToClient(&rectAnchor);
     
     // .get the size of the sub table dialog
     
     m_dlgSubTable.GetClientRect(&rectSubTable);          
     
     // .position the window over the anchor - (for a child window, 
     MoveWindow() wants
     //  client coordinates)
     
     m_dlgSubTable.MoveWindow(rectAnchor.left,
                              rectAnchor.top,
                              rectSubTable.right,
                              rectSubTable.bottom,
                              FALSE);
     
     // .display the embedded dialog control window
     
     m_dlgSubTable.ShowWindow(TRUE);
     
     return(TRUE);
     
     } //////////////////// .end function: CBHODlg::OnInitDialog()
     
     
                                              Thomas Murtola
                                              WRQ, Inc.
                                              1500 Dexter Avenue North
                                              Seattle, WA 98109
                                              tomm@wrq.com
     


______________________________ Reply Separator _________________________________
Subject: Embedding a CPropertySheet in a CDialog object.
Author:  mfc-l@netcom.com at CCINTNET
Date:    8/8/96 12:01 AM


     
     Enviroment: VC++ 4.0 and Windows NT 3.51, Win32s
     
     Hi there!
     
     How can I embed a property sheet in a modal dialog box.
     (or more general: how to embed a dialog box in a dialog box)
     
     I tried to execute a Sample out of 'Kruglinsky - Inside Visual C++': 
     example Ex087B but it didn't work!
     
 IT'S REALY IMPORTANT (NOT ONLY FOR ME!)
     
     Anybody who has some experience on this... please throw some light... 
     thanks ...
-- 
     
                        ?:) Mariusz
     
-------------------------------------------------------------------
 Mariusz Sieczka                TECHNODAT GmbH. 
 sm@technodat.co.at             CIMGRAPH  Product Development 
 Tel: +662/454944-123           A-5020 Salzburg
 Fax: +662/454944-9             Jakob-Haringerstrasse 6
-------------------------------------------------------------------





| Вернуться в корень Архива |