Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 961
knaser Avatar asked Nov 28 '08 15:11

knaser


1 Answers

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

like image 108
Roland Rabien Avatar answered Sep 21 '22 17:09

Roland Rabien