Often, you will want to specify a single response for an entire class of objects, but to vary slightly the actions that are performed for the objects that make up the class. The built-in functions parameter and object are especially useful in this situation, to customize the actions performed for the objects in the class. For example:
graphical region InputArea ...
graphical region Keypad ...
key One at position ... in Keypad
...
parameter is "1"
key Two at position ... in Keypad
...
parameter is "2"
class NumberKeys is One Two ...
response to NumberKeys
if (object = "EnterKey") then
make InputArea invisible
else
add to InputArea
text parameter
end if
When any key that is a member of the NumberKeys class is selected, the response to NumberKeys response statement is performed, but the specific actions depend on the particular key that is selected. The value returned by the parameter function is different for each key. If the One key is selected, for example, the number "1" is displayed in the region InputArea. (The if/else conditional action statement is discussed in Controlling Flow Within A Program.)