Re-using Components

Combining Components to Create Composites

Composites are custom components that consist of at least two existing components. You should consider creating a composite if you find that you frequently place the same few components together on different frames to accomplish a specific task. For example, if you often enable your users to type in a file path value or select that file path by clicking a browse button, you might consider creating a composite that includes a text field and a browse button.
If you often enable users to make a color selection from a list box, you might consider creating a composite that includes a list box and a color list.
You can save a composite if you think you might want to use it again (either in the current application or in another application). The process of saving a composite actually prompts you to create a new class. To use the composite again, you would create an instance of the new composite class.
Composites can be a combination of
  • two or more visual controls, such as a check box control and a container box control
  • a visual control, such as a list box control, and a non-visual component, such as a color list model
For step-by-step instructions on creating a composite, see “Creating Composite Controls” in the SAS/AF online Help.

Subclassing

If you find that you consistently modify an existing component for use in one or many applications, you might want to make a subclass of that component's class. For example, if you want the default text in a push button control to be OK instead of Button, then you could subclass the push button control.
For more information about subclassing, see Creating Your Own Components.

Writing Methods

You can write new methods that override or are added to an existing class. The method writing process enables you to reuse an existing class by modifying it slightly for your current needs.
For more information, see Managing Methods.