knaser
knaser

Reputation: 1441

Which is preferred CTabCtrl vs. CPropertySheet in MFC?

I don't know how to use both of them. So a sample code with pros and cons is perfect. Which one is preferred? Why?

Upvotes: 8

Views: 8051

Answers (1)

Roland Rabien
Roland Rabien

Reputation: 8836

Neither is preferred, they serve different purposes. If you want a dialog with several pages, use a CPropertySheet. If you need a dialog with several pages while part of the dialog remains fixed, use a CTabCtrl. A CTabCtrl can be used do everything a CPropertySheet can do, but since the CTabCtrl is more complex to use, it shouldn't be used unless you need its extra flexibility. A CPropertySheet can also be used as a wizard by setting a few flags.

The following is an example of using a CTabCtrl:

aCTabCtrl Example http://rabien.com/image/xcolordialog1.png

If this was a CPropertySheet, then it would not be possible to put the sample colors outside of the tabs. (And the buttons would have to be at the bottom)

Tutorial on CPropertySheet

Tutorial on CTabCtrl

Upvotes: 18

Related Questions