Deriving a CProperty base class questions 
Author Message
 Deriving a CProperty base class questions

Hi,

I am trying to construct a base class which it derives from CPropertyPage.
The purpose of course is to provide a general methods where I take care the
general features and all everyone else need to do is to derive from my base
class when they need to create a CPropertyPage.

Questions:

1.    How do I take care of the constructor where it requires the Derived
class to
       pass in the Dialog ID?
2.    How do I DoDataExchange() and take care of message maps stuff?
       Should I strip out the message map etc?

Thanks for any helps.

CMyPropertyPage::CMyPropertyPage() : CPropertyPage(CMyPropertyPage2::IDD)
{
     //{{AFX_DATA_INIT(CMyPropertyPage)
      // NOTE: the ClassWizard will add member initialization here
     //}}AFX_DATA_INIT

Quote:
}

CMyPropertyPage::~CMyPropertyPage()
{
Quote:
}

void CMyPropertyPage::DoDataExchange(CDataExchange* pDX)
{
     CPropertyPage::DoDataExchange(pDX);
     //{{AFX_DATA_MAP(CMyPropertyPage)
      // NOTE: the ClassWizard will add DDX and DDV calls here
     //}}AFX_DATA_MAP

Quote:
}

where everyone derive from my base class.


Fri, 28 Apr 2000 03:00:00 GMT  
 Deriving a CProperty base class questions

Hi Brian,

Here's an example,

/////////////////////////////////////////////////
// mybasepage.h

class AFX_EXT_CLASS MyBasePage : public CPropertyPage
{
        DECLARE_DYNCREATE(MyBasePage)

public:
        MyBasePage( UINT Template );
        MyBasePage();
        ~MyBasePage();

        enum { IDD = 0 };

Quote:
}

/////////////////////////////////////////////////
// mybasepage.cpp

IMPLEMENT_DYNCREATE(MyBasePage, CPropertyPage)

MyBasePage::MyBasePage( UINT Template ) : CPropertyPage( Template )
{

Quote:
}

MyBasePage::MyBasePage() : CPropertyPage(MyBasePage::IDD)
{

Quote:
}

/////////////////////////////////////////////////
// mypage.h

class MyPage : public MyBasePage
{

public:
        MyPage();

        DECLARE_DYNCREATE(MyPage)

        enum { IDD = IDD_MYPAGE };

Quote:
}

/////////////////////////////////////////////////
// mypage.cpp

IMPLEMENT_DYNCREATE(MyPage, MyBasePage)

MyPage::MyPage() : MyBasePage( MyPage::IDD )
{

Quote:
}

regards,

Bob



Fri, 28 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Deriving a CProperty base class questions

2. How to Create CCtrlView derived class based on CTreeCtrl derived class

3. How to Create CCtrlView derived class based on CTreeCtrl derived class

4. How to Stop Derived Class from overriding base class method

5. creating an instance of a derived class from a base class

6. How to prevent derived classes from changing a base class function

7. address of base class and derived class different

8. Deriving from CControlBar - no base class in New Class dialog

9. CDialog derived class as a base class for another dialog box

10. serializing a class derived from an abstract base class

11. Serialize class derived from virtual base class

12. How do I cast base class to a derived class

 

 
Powered by phpBB® Forum Software