Property page how to question 
Author Message
 Property page how to question

Hello and Help,
What I am trying to accomplish is this.
I want to take a bunch of forms(CDaoRecordView) I built using Resource
editor and class wizard. And display them in kind of a CPropertyPage on
another dialog box (or for that matter a CTabCtrl. When the user selects a
tab it will display the resource associated with the tab. The other buttons
and the display of the base form I have figured out. I can create and
display both empty sheets or tabs with the correct text. I am stuggling
casting the CDaoRecordView to CPropertypage on the CPropertySheet->AddPage
command. Any suggestions or examples would be greatly appreciated. Oh yea
Assume that I am a new MFC user with limited C++ experience please.'
Thank you
Doug McGill


Mon, 23 Aug 2004 07:37:31 GMT  
 Property page how to question

Quote:

> Hello and Help,
> What I am trying to accomplish is this.
> I want to take a bunch of forms(CDaoRecordView) I built using Resource
> editor and class wizard. And display them in kind of a CPropertyPage on
> another dialog box (or for that matter a CTabCtrl. When the user selects a
> tab it will display the resource associated with the tab. The other buttons
> and the display of the base form I have figured out. I can create and
> display both empty sheets or tabs with the correct text. I am stuggling
> casting the CDaoRecordView to CPropertypage on the CPropertySheet->AddPage
> command. Any suggestions or examples would be greatly appreciated. Oh yea
> Assume that I am a new MFC user with limited C++ experience please.'
> Thank you
> Doug McGill

If you want to use CPropertyPage/CPropertySheet then you will have to
use the wizard to produce a new class, derived from CPropertyPage,
associated with the dialog resource.  

If you want to use CTabCtrl (more difficult) then you will have to use
the wizard to produce a new class, derived from CDialog, associated with
the dialog resource.  Turn off the titlebar and border styles in the
resource.  That makes it look like a "page".  Use this dialog class (one
per page, actually) as a modeless dialog.  What you do is call Create
for all the modeless dialogs, but make only one of them at a time
visible when the user selects a tab.  Here's an example of putting
modeless dialog "pages" on a tab control:

void CSomeDialog::OnInitDialog()
{
 CDialog::OnInitialUpdate();

 TCITEM tci;
 tci.mask = TCIF_TEXT;
 tci.pszText = "System";
 m_tab1.InsertItem(0, &tci); // m_tab1 is CTabCtrl
 tci.pszText = "Config";
 m_tab1.InsertItem(1, &tci);

 m_pDlg1 = new CDlg1(&m_tab1);      // modeless dialogs
 m_pDlg2 = new CDlg2(&m_tab1);   // used as tab pages
 CRect rcTab, rcPage;
 m_tab1.GetWindowRect(rcPage);
 m_tab1.ScreenToClient(rcPage); // tab window rect
 m_tab1.GetItemRect(0, &rcTab);     // rect of tab
 rcPage.top += rcTab.Height();
 rcPage.DeflateRect(4,4);
 m_pDlg1->MoveWindow(rcPage);
 m_pDlg2->MoveWindow(rcPage);
 m_pDlg1->ShowWindow(SW_SHOW);

Quote:
}

CDlg1::CDlg1(CWnd* pParent /*=NULL*/)
        : CDialog(CDlg1::IDD, pParent)
{
 //{{AFX_DATA_INIT(CDlg1)
 // NOTE: the ClassWizard will add member initialization here
 //}}AFX_DATA_INIT
 Create(CDlg1::IDD, pParent);

Quote:
}

--
Scott McPhillips [VC++ MVP]


Mon, 23 Aug 2004 10:03:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Property Pages and a question or 2

2. questions regarding property sheet and property page

3. Property Sheet/Property Page Question

4. Property Pages in a Property Page

5. A question about Property Page.

6. Property page question

7. Property Pages and Tab Controls questions

8. Property page question

9. Property Page Question?

10. Property pages question...

11. Property page question

12. Property Pages - Formatting Question

 

 
Powered by phpBB® Forum Software