|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThe point behind this article is to build a base for building a Netscape Prefs like dialog without compromising on the benefits provided by To implement this dialog: Step 1Add the files present in the source zip file above, to your project. Add the following lines in some globally available file like stdafx.h: #include "EZPropertyPage.h" #include "EZOptionsDlg.h" Step 2Add a dialog to your application and add a class for it, say Step 3Edit the dialog template and add a tree control somewhere on the dialog. Add the following lines to the // Assuming IDC_OPT_TREE and IDC_LABEL are the ID's // of the tree control and the static control respectively SetTreeCtrl(IDC_OPT_TREE); Step 4Add a property page, Now, as you would do in a regular property sheet, declare a member variable for // If IDD_PROPPAGE_PAGE1 id the dialog resource ID m_page1.Create(IDD_PROPPAGE_PAGE1); AddPage(&m_page1,_T("Page1")); If you want to add a page as a child item, add the title of the parent item as the third parameter. To avoid unexpected behavior, the titles should be unique. Here is the // in PrefDlg.h #include "EZOptionsDlg.h" class CPage1; class CPrefDlg:public CEZOptionsDlg { ... private: CPage1 m_page1; }; // in PrefDlg.cpp BOOL CPrefDlg::OnInitDialog() { ... // Assuming IDC_OPT_TREE is the ID's of the Tree control // and the static control respectively SetTreeCtrl(IDC_OPT_TREE); ... m_page1.Create(IDD_PROPPAGE_PAGE1); AddPage(&m_page1,_T("Page1")); SelectPage(_T("Page1")); m_wndTree.ExpandAll(); } Again, to remove a page, the title is to be used. This is the reason why I say the titles should be unique. RemovePage(_T("Page1")); Repeat the above step to add more pages. The demo project should do the rest of the explanation.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||