COptionSheet: A replacement for CPropertySheet


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Click here for larger image

COptionSheet with a CSMLStatic page

Click here for larger image

COptionSheet displaying a page from a group

Environment: VC6 SP5, Win9x, WinNT, Win2000, WinXP


COptionSheet and COptionPage are prime examples of something simple that takes on a mind of it's own. I had originally started this as an extension to the CPropertySheet and CPropertyPage classes but quickly abandoned using the common control due to how problematic it was to extend it's functionality. For some reason, cosmic forces guided me to implement a complete set of stand alone classes containing the functionality of CPropertySheet and CPropertyPage.

Every effort was made to provide as much compatibility with both CPropertySheet and CPropertyPage in order to allow changing existing implementations over with little to now modifications. Included with the source distribution is a help file containing all of the method and attribute information needed to get started. Even though some documentation is included, as long as you are familiar with using property sheets, you should have no problem.


The COptionSheet collection includes several enhancements over the standard Property Sheet common control. Those features are listed here:

  • Completely independant of the Windows property sheet common control.
  • Three modes of operations:
    • Options mode using with an abstract interface to a child control for displaying a list of all pages.
    • Standard wizard mode similar to that of the property sheet common control.
    • Extended wizard mode which extends the property page to the edge of the option sheet window.
  • Supports page grouping In non-wizard mode.
  • Includes a sample COptionListBox control (derived from CListBox) allowing immediate use of the option sheet class.
  • Includes the COptionPageStaticText class for quickly creating option pages which display only information or text. Supports either plain text or text formatted with Small Markup Language. (This class uses my CSMLStatic class which I recently submitted. Source for CSMLStatic is included in this source archive for COptionSheet).
  • Includes documentation.

Using COptionSheet:

Using the COptionSheet is very similar to using a CPropertSheet object with only a few exceptions. If you are want to use groups, you will need to add them priort to adding any option pages. You will also need to add some type of child list control if you are not running in wizard mode (the included COptionListBox class is for just this purpose although you are free to create your own).
The following code

// Declare a sheet, group, and some pages
COptionSheet        optionSheet(IDS_DEMOAPP);
COptionListBox      listBox;
COptionPageStaticText myGroup(IDS_INTRO, IDR_INTRODOC);
CProgCtrlPage       myPage1;
CSliderCtrlPage     myPage2;
CSpinCtrlPage       myPage3;

// Set the child list control to use

// Check to use wizard mode.
if(TRUE == useWizardMode) {

// Add in the group

// Add in the pages
optionSheet.AddPage(&myPage1, &myGroup);
optionSheet.AddPage(&myPage2, &myGroup);
optionSheet.AddPage(&myPage3, &myGroup);

// Run the modal loop

Here are a few things you should keep in mind:

  • If you are converting a CPropertySheet to use COptionSheet, the flag options are different. Make sure that you change them to their corresponsing COptionSheet values or things may not work right.
  • If you are using wizard mode, and you add a group, keep in mind that the groups pages WILL be displayed and that both group pages and normal pages will be displayed in the order they were added.
  • You MUST set a child list control before calling DoModal() or an assertion will be thrown as COptionSheet does not create a default control for the page list (in non-wizard mode).
  • The abstraction layer for child list controls was created so that ANY control that can be used for display a list of pages can be created. The supplied example (COptionListBox) is derived from a standard CListBox control and includes several enhancements. You have the option of using a Tree control, Icon list control, or any CWnd derived control you wish to create.
  • COptionSheet WORKS for my purposes - this does not mean that there are not any bugs or operational errors hidden somewhere in the code. Let me know if you find any and I try to fix the problem as soon as I can.


Download demo project - 76Kb
Download source - 136Kb


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date