Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

The CExtPropertyStore class implements the root item in a tree data structure with CExtPropertyItem objects (which describe property categories and values). You can compare a property store with a document, and the property grid window (which is based in the CExtPropertyGridWnd class) as a view in terms of the document-view architecture.

Typically you declare an instance of the CExtPropertyStore class in the class that represents one or more objects whose properties are displayed in the property grid. Then you simply add the required categories and values to this instance somewhere in the code before a pointer to the property store is requested for the first time. You also need to define pairs of ...Get() and ...Set() methods (only ...Get() methods for read-only properties), for instance, TextColorGet() and TextColorSet().

There are two ways to display properties of the particular object in the property grid:

1) Attach the property store using the CExtPropertyGridCtrl::PropertyStoreSet() method and update the property grid window with the CExtPropertyGridCtrl::PropertyStoreSynchronize() method;

2) Add a pointer to the property store to the built-in combo box (the CExtPropertyGridComboBoxBar class) and select this item with the SetCurSel() method of the combo box.

The Prof-UIS property grid features displaying and editing properties of more than one object simultaneously. Some properties whose values are different for at least one object are specially marked: for most cell types, the property value cell gets blank but the color selection cell is marked with the question sign inside the gray rectangle. By modifying a property, you modify the same property for all objects whose properties are displayed in the property grid. The operation of combining properties of several objects is performed with the Combine() method of the property store:

- declare a separate property grid in the same class where the property grid is used;

- you may need to clear this combined property grid from the previously added property stores by using the ItemRemove() method;

- use Combine() method as many times as necessary;

- set the combined property store to the grid with one of the above described ways.