Grouping Controls

 
 
 

Grouping controls allows you to align controls together in columns, indicate the relationship of associated controls using a surrounding frame, and nest groups within groups.

Controls are ordered linearly in the PPGLayout: that is, the order in which you declare the controls is the order in which they appear on the property page.

To group a set of controls together, insert the PPGLayout.AddGroup or PPGLayout::AddGroup call before the first member-to-be and the PPGLayout.EndGroup or PPGLayout::EndGroup call after the last.

Tip

When you omit the last PPGLayout.EndGroup or PPGLayout::EndGroup call, all controls from the preceding PPGLayout.AddGroup or PPGLayout::AddGroup call to the last control on the page will be part of that group.

When you create your group control you can optionally specify a label and a frame (both or none) and the percentage of a row that the group will occupy, if applicable.

You can also set these and other attributes dynamically by using the PPGItem.SetAttribute method with one of these item attributes:

Available on all Controls also as a property on the PPGItem object:

Specific to the Group control:

Group controls can be enumerated by setting up a loop using the PPGLayout.Count or PPGLayout::GetCount property and testing each PPGLayout.Item or PPGLayout::GetItem to see if it's a group (see Changing the Layout for more information).

The PPGLayout.Item or PPGLayout::GetItem property takes either the index or the name of the item, so you can test it using the PPGItem.Type or PPGItem::GetType property as in the following example:

function ChangeLastGroupLabel_OnClicked() {
	// Loop backwards through the list of items to find the group tag 
	// that starts the last group 
	for (var i=PPG.PPGLayout.Count-1; i>=0; i--) {

		// Test for "GroupBegin" (type of opening tag)
		if (PPG.PPGLayout.Item(i).Type == "GroupBegin") {

			// When we find it, reset the label
			PPG.PPGLayout.Item(i).Label = "Last Group";
			PPG.PPGLayout.Item(i).SetAttribute( siUIShowFrame, false );

			// We need to refresh the layout to see the changes and then
			// we're done!
			PPG.Refresh();
			break;
		}
	}
}