User's Guide

Defining the attributes

You are now ready to implement your design in the Public Interface Editor. Begin by defining the attributes of your runner part. A part's attributes typically correlate to the part's Attribute data types and can additionally include derived attributes, or attributes that are determined based on the value of other attributes.

In the Public Interface Editor, on the Attribute page of the notebook, do the following:

  1. Type number in the Attribute name entry field and select the Add with defaults push button.

    Your Public Interface Editor will look like this:
    Public Interface Editor

    Notice that several default values are displayed:

  2. You can change any of the default values if you need to. Change the value in the Attribute data type field to String, because in this example the runner's number is a simple three-character string of numerals, and select the Update push button.
  3. Repeat the previous steps for the runner's finishTime attribute. Type finishTime as the Attribute name. Select Add with defaults, and change the Attribute data type to Time, because the runner's finish time is a time.
  4. The runner also has one derived attribute, asResultString. Type this attribute name but do not select Add with defaults. Instead, enter asResultString as the Get selector, enter runnerChanged as the Change event symbol, and enter String as the Attribute data type. Ensure the Set selector is blank. Then, select the Add push button.

    Every time the runner part receives the runnerChanged event, it will refresh the value of its asResultString attribute by running the asResultString get selector. Because there is no set selector, the attribute is read-only, so other parts cannot set it.

Now is a good time to save your work. Select Save Part from the File menu.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]