space
Previous Page | Next Page

Communicating with Components

Model/View Communication

Components are often separated into two categories: those that display data (viewers) and those that provide access to data (models). These different kinds of components break the complex process of displaying data into logical parts. See Models and Viewers for more information about model/view architecture.

SAS/AF software provides an easy way for you to add model components and viewer components to your applications. You can set model/view component communication during application build time (that is, within the Build window) by

For step-by-step information, see "Assigning Models to Viewers" in the SAS/AF online Help.


Determining When to Use Model/View Communication

Use model/view communication when you want to attach a non-visual component (model) to a visual component (viewer) to display specific data.

The following table lists the default models and viewers that SAS/AF software provides. It also shows which models and viewers can be used together. Within the corresponding sections of the table, any model on the left can be used with any viewer on the right. The appropriate model/view combination depends on your final goal.

Use any of these models... with any of these viewers...
Catalog Entry List

Catalog List

Color List

Data Set List

External File List

Library List

LIST Entry List

SAS File List

SLIST Entry List

Variable List

Variable Values List

Combo Box

List Box

Radio Box

Spin Box

SAS Data Set

SCL List

Form Viewer

Table Viewer

Note:   You can create and/or customize models and viewers within a SAS/AF application if the models and viewers that are provided do not meet the needs of your application. For information on creating a new model or viewer, see Implementing Model/View Communication. In addition, if you plan to use a model/view pair regularly, you might want to create a composite. For more information on creating a composite, see "Creating Composite Controls" in the SAS/AF online Help.  [cautionend]


Examples

You can use model/view communication to display a list of color choices in a list box. Additionally, you can set this model/view component communication by dragging and dropping components, or by using the Properties window.

To set model/view communication by dragging and dropping components:

  1. Create or open a FRAME entry.

  2. Drag a List Box control from the Components window and drop it onto the frame.

  3. Drag the Color List model from the Components window and drop it onto the List Box.

To set model/view communication with the Properties window:

  1. Create or open a FRAME entry.

  2. Drag a List Box control from the Components window and drop it onto the frame.

  3. Drag a Color List model from the Components window and drop it onto the frame.

  4. Open the Properties window.

  5. In the Properties window, open the Attributes table for the List Box control.

  6. Set the model attribute value to the Color List model.

The above examples show that some models can return information at build time. The list box that serves as the viewer is automatically populated with values when the model is attached.

The following example shows that other models return information only at run time. In this situation, the model information is not displayed in the viewer during build time.

  1. Create or open a FRAME entry.

  2. Place a Combo Box control and a Catalog List model on the frame.

  3. Open the Properties window.

  4. In the Properties window, open the Attributes table for the Combo Box control.

  5. Set the model attribute value to the Catalog List model.

  6. In the Properties window, open the Attributes table for the Catalog List model.

  7. Set the library attribute value to an existing library.

  8. Select Build [arrow] Test to run the frame and then select the down arrow in the combo box to see a catalog list.

space
Previous Page | Next Page | Top of Page