| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 11)

Item Expressions

These expressions refer to an item or, for the designated generic reference expressions, a set of items.

Referring by Item Name

To refer to an item by name:

In most contexts, specifying a symbol that names an item produces that item, for use by an action or in an expression.

Referring Through a Symbolic Expression

To refer to an item by a symbolic expression:

With the the quantifier, this generic reference expression produces the one and only item of the specified class whose item name is produced from symbolic-expression. This expression indirectly references an item.

With the any quantifier, this expression produces the set of items of the specified class whose item name is produced from symbolic-expression.

Referring By Variable or Parameter Name

To refer to an item by a variable or a parameter name:

In some contexts, specifying a symbol that names a variable or parameter produces its current value, if one exists.

Referring By Workspace Location

To refer to an item by its location upon a workspace:

With the the quantifier, this generic reference expression produces the one and only item of the specified class that G2 finds upon the specified workspace. With the any quantifier, this expression produces the set of items of the specified class upon the specified workspace.

Referring By Identity

To reference an item by identity:

This expression produces a truth-value that indicates whether an item referenced in one manner is the same item as another item referenced in a different manner. For example:

This generic if rule checks whether tank-1 is among the items that participate in a downstream-of relation with the item water-outflow-2.

Referring By Association with an Event or Location

These expressions refer to the item that is associated with an event or to the workspace that contains the item in which the expression is evaluated.

To reference an item through its associated window:

This expression produces the G2 window that receives the user gesture associated with this expression. Specify this expression only in the Action attribute of an action button or in the Action attribute of a user menu choice.

For example, this action affects the workspace that contains an action button that, when pressed, causes this action's this window expression to be evaluated:

To reference an item through its workspace:

This expression produces the parent workspace of the item within which this expression is evaluated.


Note: If the this workspace expression is evaluated as the result of selecting a user menu choice, it produces the workspace that contains the user menu choice, not the workspace that contains the selected item.

Referring By Item Evaluation

Several expressions refer to the item associated with the executable item in which the expression is evaluated.

To reference the item from whose menu a user menu choice is selected:

Specify this expression only in the Action attribute of a user menu choice, to refer to the item from whose menu this user menu choice is selected.

The the item expression is valid regardless of the class named in the user menu choice's Applicable-class attribute.

For example, the next figure shows a user menu choice whose Action attribute specifies the action rotate the item by 90 degrees.


| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 11)

Copyright © 1997 Gensym Corporation, Inc.