User's Guide

Defining the attributes

On the Attribute page, you define the names of the attributes that appear on the part's pop-up menu. Usually, the attribute name matches an instance variable name. You can make the attribute name different from the instance variable name if you want to, but it is usually best to make the names match. You can also have attributes that are derived attributes, which means that they are determined from other values, not stored as an instance variable. Let's add the length attribute: In the Attribute name field type length, and select Add with defaults.

Your Public Interface Editor looks like the following:
Public Interface Editor

Notice the default values that are displayed:

To understand how these selectors are used, imagine how your timer part might be used in a VisualAge window. Suppose the window has one text-entry field with an attribute-to-attribute connection between your timer part's length attribute and the text-entry field's object attribute. The get selector runs when the window first opens, to get your timer's length attribute and set its value into the text-entry field. If the user types a different value into the text-entry field, the set selector updates the timer's length attribute.

Adding the repeat attribute

Add the repeat attribute by typing repeat in the Attribute name field and selecting Defaults. Change the value in the Attribute data type field to Boolean, and select Add.


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