space
Previous Page | Next Page

Communicating with Components

Attribute Linking

Attribute linking enables components to interact without the need for any SAS Component Language (SCL) code. Instead, interactions are specified with the Properties window.

Attribute linking involves setting the Link To values of a component's attributes. For example, if you want the text value that is entered into a text field to update a graph output control, link the graph output control's graph attribute to the text entry control's text attribute. You can define attribute links between attributes on the same component or between different components on the same frame.


Determining When to Use Attribute Linking

Use attribute linking when you


Establishing an Attribute Link

To establish an attribute link between two attributes, you define the link on the attribute that you want to receive the new value. Attribute linking includes the following steps:

  1. Identify the component whose attribute or behavior you want to dynamically change. For example, you may want to change whether a text entry control is enabled or disabled.

  2. In the Properties window Attribute table, find the component attribute that you want to change. In the case of our text entry control, it would be the enabled attribute.

  3. Define the link on that attribute by specifying a value in its Link To cell. For example, you might link the text entry control's enabled attribute to the selected attribute of a check box control that is also present on the frame.

An attribute link consists of a componentName/attributeName pair where

componentName

refers to the component that owns the above attribute

attributeName

refers to the attribute that contains the value that you want your linked attribute to contain


Example

Suppose your application prompts a user to choose whether or not they receive e-mail messages. Your frame might include a check box labeled "Do you have an e-mail account?" If the user clicks the check box, then a text label and text entry field are enabled so that the user can enter an e-mail address.

You can complete this type of component communication with multiple attribute links. The following steps detail the process:

  1. Create a new FRAME entry.

  2. Place a check box control on the frame and change its label attribute to "Do you have an e-mail account?"

    You can use the Properties window to change the label attribute.

  3. Place a text label and a text entry control on the frame.

    The text label should be positioned on the left of the text entry and should be labeled "e-mail address:"

  4. Link the enabled attribute of the text entry control to the selected attribute of the check box.

  5. Link the enabled attribute of the text label object to the enabled attribute of the text entry object.

  6. Test the frame by selecting Build [arrow] Test.

Note:   This example is used to describe attribute linking only. Other tasks would be necessary to complete this frame and make it function properly within an application.  [cautionend]

When you select the check box, the text label and text entry objects become available. When you deselect the check box, the text label and text entry objects become grayed and are therefore unavailable.

[untitled graphic]

space
Previous Page | Next Page | Top of Page