| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (4 out of 4)

Using Actions With Messages

You can create, manipulate, and delete messages by using actions. When you create a message with a create action, the message is transient and can be deleted with the delete action. You can transfer such messages to a particular workspace, and also change the text, text-color, and background-color by using a change the text of or a conclude action.

Use these actions when working with messages:

The next sections provide functional descriptions of each of these actions. For a complete description of all G2 actions, see Chapter 19, Actions.

Changing the Color Attributes of Message Properties

Messages have three color attributes that you can change programmatically:

You can change one or more color attributes with the change action, as the next two examples show. In the first example, the action changes the text-color color attribute. In the second, use the change the color-pattern of action to change all the message's color attributes.


Changing the Text of a Message

Use the change the text of action to change the contents of a message, as the following example illustrates.


The change action lets you change the text of any free-text or message programmatically.

Concluding Message Text into a Variable or Parameter

You can conclude a new value for a text variable, text parameter, or any attribute that receives a value from a text variable or text parameter, using a text-expression. The text-expression could be the text of a message, as the next example illustrates.


In this example, text-var is the name of a text variable, into which G2 concludes the text of the message, M1.

Creating and Transferring Transient Messages

Create and transfer messages with the create and transfer actions. The next example shows you how to create a transient message and transfer it to the workspace of the action button from which it was created.


Transient messages are deleted automatically whenever you reset the KB.

Deleting Transient Messages

Use the delete action to delete a transient message. The next example deletes every transient message upon a particular workspace.


| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (4 out of 4)

Copyright © 1997 Gensym Corporation, Inc.