Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help : Create a dialog box with

Status
Not open for further replies.

phe2

Technical User
Apr 11, 2002
6
FR
I search how do to create a tab control with the proprety : CPropertySheet.
This table is constituted of:
- a dialog box with 2 tabs.
I created one dialog box per tab and it's ok,
but I would like to know how declare only one the dialog box for this two tabs.
example :
CToto m_ptoto;->first tab,
CToto m_ptoto1;->second tab,
CToto corresponds to 1 dialog box.
Thank's.
 
Hi,

In order to do this you first create your dialogs in the Resource Editor (remembering to remove the OK and Cancel buttons).

Set the following properties for the Dialog:

Styles Tab

Style = Child
Border = Thin
Title Bar = Yes
All other options = No

More Styles Tab

Disabled = Yes
All other options = No

Then call class wizard (Ctrl+W) and create a new class for the each of the dialogs. When creating the class set the base class to CPropertyPage and NOT CDialog.

Once you have done this Use the Insert menu option and insert a new Class and Set its base Class to CPorpertySheet.

Open the Header (.h) File for this new Class and #include the Headers for the two dialogs you just created.

Add two Private member variables one for each page.

e.g.
private:
CMyPage1 m_Page1 ;
CMyPage2 m_Page2 ;

Open the Source (.cpp) file and in the constructor add:

AddPage (&m_Page1) ;
AddPage (&m_Page2) ;

Done.

In the Source where you handle your menu options create a handler (or edit existing) to display the Porperty Pages, for example:

CMyPropertySheet* pProps = new CMyPropertySheet("My Caption", this) ;
if (pProps)
{
pProps->SetWizardMode() ;
pProps->DoModal() ;
}
else
{ AfxMessageBox("Unable to create Property Pages", MB_ICONSTOP | MB_OK) ; }
delete pProps ;

Of course remember to #include your PropertySheets header file in the sources header file.

HTH


William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top