Property Sheets

A property sheet is a window that lets the user switch among pages of information to view and edit the properties of an item or an object. Property sheets are also referred to as tabbed dialog boxes (because you use tabs to navigate among modeless dialog boxes); each page in a property sheet is analogous to a dialog box. In a spreadsheet application, for instance, one property sheet might allow the user to set both the font properties and the border properties of a cell, with font properties listed on one page and border properties on another. The Windows 95 user interface includes numerous property sheets, so developers who are aiming for a consistent look and feel should seriously consider using this common control.

The PROPS sample, which I wrote in C, displays a property sheet that lets the user view and change the properties of a trackbar. Each group of properties is marked by a tab and appears on a separate page. As you can see in Figure 4-3, this property sheet has two tabs: Trackbar Range and Trackbar Page And Line Size. When the user selects a tab, the associated page moves to the foreground of the property sheet. For example, to change the trackbar page size, the user clicks the Trackbar Page And Line Size tab to bring that page to the foreground and then changes the values as desired.

 

Figure 4-3.

An example of a property sheet.

Essentially, a property sheet is a system-defined modeless dialog box, and each page is an application-defined modeless dialog box. The property sheet is a container for the pages and is responsible for managing them. It includes a frame, a title bar, and four buttons: OK, Cancel, Apply, and (optionally) Help. A property sheet must have at least 1 page and can have as many as 24 pages.

Much like a typical dialog box, each page manages its own control windows (such as edit controls and list box controls). The application provides a dialog template and a dialog procedure for the page. Each page has a label (the text displayed on the tab) and can also have an icon. When the property sheet creates the tab for the page, it displays the label and the icon in the tab. If the property sheet has only one page, the tab for the page is not displayed.