| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 30)

change

This action changes these properties of items:

The change action does not make permanent changes; the effects of the actions are undone when you reset G2. In some cases, you can make these changes permanent by using the make permanent action, as described under make.

You can also make many permanent changes by using the conclude action, as described under conclude, in conjunction with attribute access, as described in Chapter 12, Attribute Access Facility.

Changing List and Array Elements

Using the change action with lists and arrays is described in Using Other List and Array Expressions.

Changing the Color Attribute of an Item

To change the color of an item:

The color attribute you specify varies with the type of item. For example, only connections have a stripe-color color attribute. Workspaces and messages have a background-color, while messages and textual items, such as rules, have a text-color.

Two versions of this action exist. The first lets you change a single color-attribute, the second, change the color-pattern of, lets you change more than one color-attribute of an item in one statement.

These examples show you how to change a single color-attribute, and then two attributes, using the color-pattern of statement:


If you try to change multiple icon regions by using the change the color-pattern action, and a specified icon region does not exist, G2 signals an error.

You can obtain the various color attributes of any item with color operations systems procedures. For a description of these, see the G2 System Procedures Reference Manual.

Changing the Icon Color Region of Instances

The change the icon-color of action changes any region of a system- or user-defined region called icon-color.

All system-defined icons have multiple named regions, including icon-color. You can use the color operations system procedures to get a list of all region names and their corresponding colors, and then change them. The color operations system procedures are described in the G2 System Procedures Reference Manual.

To change an icon's icon-color region:

Using this action has different results depending on how the icon is defined:

If the icon-description of the class includes... Then the action has this effect...
A region called icon-color
Changes only the color of the icon-color region
At least one color set to the foreground metacolor
Changes the binding of the foreground metacolor to the new color. Subsequently adding an icon-color region causes any foreground color to revert to its previous binding.
No foreground color and no icon-color region
None.

Changing the Color of any Named Icon Region

You can change the color of any named icon region. Icon regions are described in Defining Regions.

To change the color of an icon region:

Use this action to change any icon region not called icon-color. This example changes the region called inner-circle of the object instance circle1 to green:


Use the color operations system procedures, described in the G2 System Procedures Reference Manual to change multiple icon regions programmatically.

Changing the Name of an Item

Use this action to give an item a new Names attribute value and to replace any existing values.

You can use the change the name of action to generate names for transient items.

To change the name of an item:

An example is:



Note: The Names attribute requires a symbolic value, so you must precede the item name using the symbol statement.

You can also use attribute access to reference and change most attribute values, as described in Chapter 12, Attribute Access Facility.

Minimizing the Size of a Workspace

Use this action to shrink wrap a workspace, which you refer to with any kb-workspace expression.

To change the size of a workspace to its minimum size:

An example is:


Changing the Text of an Attribute


Note: In most cases, the attribute access facility supersedes the use of the change the text of action. However, all such actions continue to be supported. Attribute access is described in
Chapter 12, Attribute Access Facility.

Use this action to change the value of any user-defined attribute and most system-defined attributes that you would otherwise change interactively with the Text Editor.

To change the text of an item's attribute:

Enter the text-expression with surrounding quotation marks (""). If G2 detects an invalid value for the changed attribute, G2 signals an error.

Some examples follow. The first example changes the class name of an object definition. Making such a change updates all instances automatically. The second example first changes the attribute displays of the automobile class definition and then changes the text of the change attribute of that definition to update all instances with the first change.



Note: You cannot use this action to change the attribute values of tabular functions.

Use the make permanent action to make a change the text of action permanent. To make permanent changes to user-defined value attributes, use the conclude action, described on Concluding Attribute Values. For information about changing class definitions while G2 is running, see Changing Definitions.

Changing the Text of Textual Items

Use this change the text of action any time you wish to change any textual item programmatically.

To change the text of a procedure, statement, free-text, or message:

This action changes the text of a procedure, free-text, message, or statement (including generic formulas, rules, function definitions, units of measure, and remote procedure and foreign function declarations).

An example of changing the text of a message is:


To include quotes within the new text, precede each quote with the @ character. In general, the @ sign is used to escape a special character.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 30)

Copyright © 1997 Gensym Corporation, Inc.