Creating Property Pages for Composite Controls

Property pages can only exist inside a Visual Basic ActiveX control (UserControl) project, although in this case the ActiveX control is not used.

Getting the GUID

In order for the SubStart control to display additional composite property pages, it must know which property pages to display. Property pages are assigned a unique identifier, or GUID, when created.

Because Visual Basic does not expose this GUID directly, you must find it by examining the registry.

To find your property page in the registry, search for a string consisting of the project name, concatenated with a period and the form name: e.g. VBSubPropPages.SubPage1.

The GUIDs for all your property pages must be supplied to the SubStart control using the sub_PropertyPages function in the class module for the composite control project.

Project Settings

After you find the GUIDs for your property pages, set Binary Compatibility in the project settings to ensure that the GUIDs are not changed.

Transferring Data

Property pages for composite controls differ from property pages for other controls in how they save and restore the properties to the control:

Loading Data to the Property Page

When the property page is first loaded, or when the selected control subsequently changes, the SelectionChanged function in the property page is called.

Here the current property values must be retrieved from the SubStart control and displayed on the page, using the SubProps property of the composite. Remember that properties are identified by index.

EXAMPLE

This example has only one property, called count.

Private Sub PropertyPage_SelectionChanged()

'update our dialog from the first selected control
'each property should use a different index

Text1.Text = SelectedControls(index).SubProps("count")
Text2.Text = SelectedControls(index).SubProps("delay")
'update other properties here

End Sub

Saving Data from the Property Page

In the property page ApplyChanges function, the data entered is sent to the composite using the SubProps property of the composite.

Private Sub PropertyPage_ApplyChanges()
SelectedControls(index).SubProps("count") = Text1.Text
SelectedControls(index).SubProps("delay") = Text2.Text

'add other properties here...

End Sub