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

transfer

This action transfers items to the mouse, or on and off of workspaces, and to and from items and workspaces. Use the transfer action to:

You cannot transfer a workspace or a connection.


Note: The transfer action works only on transient items. You cannot transfer permanent items using this action.

Transferring Object Attributes

To transfer objects to and from objects, and from workspaces to objects:

While you can transfer virtually any attribute object to a workspace, some restrictions apply to the target attribute when transferring one attribute object to another object, or an object upon a workspace to the attribute of an object.

To transfer an object attribute to a workspace:

To transfer an object attribute to another object:

To transfer an object upon a workspace to the attribute of an object:

Referencing Transferred Objects

When transferring a named object to the attribute of an object, the transferred object retains its name. You can then reference the object either as the attribute of its object, or by its name. For example, if temperature-var is a float-variable, which you transfer to be the temp attribute of new-object, you can change the value of temperature-var with either of these statements:

Transferring an Item to the Mouse

To transfer a transient item to the mouse:

This action lets you attach the specified item to the mouse pointer so that a user can interactively place the item upon a workspace in the specified g2-window.

When entering a transfer item to the mouse action, the Text Editor includes a prompt for a positioning statement, such as at (x, y). Adding such a statement has no effect on the transfer action. The item is simply transferred to the mouse at its current location.

In the next example from the text of an action button, G2 creates a new connection post in the current window and transfers it to the mouse. In this case, the connection post will appear attached to the mouse pointer at its current position. Clicking the mouse places the item on the workspace. Action buttons can use the statement this window to refer to the current G2 window.



Note: You cannot transfer a connected item to the mouse.

If the user has already pressed down a mouse button when the transfer to the mouse action begins, the user must release that button and press a mouse button again for G2 to transfer the item to a workspace.

Transferring More Than One Item to the Mouse

You can use the transfer item to the mouse action to attach more than one item to the mouse. If you do so, G2 queues the items in a last-in, first-out basis.

Because G2 displays only one item at a time under the mouse pointer, as the user places each item upon a workspace, the next transferred item appears under the mouse pointer.

Transferring an Item to a Workspace

To transfer an item from one workspace to another, or to transfer an item that is not on a workspace to a workspace:

The at (x, y) statement represents the workspace unit integer values that specify the horizontal and vertical coordinates of the item upon the target workspace. An example is:


Removing an Item from a Workspace

To remove an item from a workspace:

G2 removes the item you specify from its current workspace, however, the item exists in the KB as a transient item that you can find through Inspect, but which is not associated with any workspace. An item must be transient before you can transfer it off of its workspace. An example is:


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

Copyright © 1997 Gensym Corporation, Inc.