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

Displaying a Workspace

A Show Workspace template is Leaf Entry template that:

A Show Workspace template is actually an interface to the G2 show workspace action. That action provides a variety of techniques for displaying a workspace at a given location and scale in a G2 window. You can use a Show Workspace template to achieve most of the effects of the show workspace action.


To use a Show Workspace template in a menu specification

  1. Include the template in the specification exactly as you would a Leaf Entry template.

  2. Edit the template's gms-display-target to specify the name of the workspace to display.

  3. Edit the various display coordinates to designate the display scale and where the workspace should appear in the window.

If the Show Workspace template specifies a callback procedure, choosing the entry first displays the workspace, then invokes the procedure. If the template does not define a callback procedure, GMS does not search for a default callback procedure, as it would for an ordinary Leaf Entry template; instead, it continues executing without notification or error.

Show Workspace Template Attributes

In addition to the attributes belonging to all Leaf Entry templates, as described in Attributes of a Menu Entry Template and Additional Attributes of a Leaf Entry Template, a Show Workspace template has the following attributes.

Attribute Description
Gms-display-target
Specifies the workspace to be displayed.
Allowable values:
A symbol that names a workspace, the superior item of a subworkspace, or an item that exists on a workspace.
Default value:
none


Gms-view-scale
Specifies the scale at which to display the workspace.
Allowable values:
A float value indicating a scale factor, or none
Default value:
none


Gms-window-symbolic-location
A symbol that specifies a point in the window.
Allowable values:
top-left-corner, top-center, top-right-corner, right-center, bottom-right-corner, bottom center, bottom-left-corner, left-center, center
Default value:
none


Gms-window-x-location Gms-window-y-location
A coordinate pair, implemented as two integer attributes, that specifies a point in the window.
Allowable values:
Any two integers
Default values:
none


Gms-window-x-offset Gms-window-y-offset
A coordinate pair, implemented as two integer attributes, that specifies an offset from a window location.
Allowable values:
Any two integers
Default values:
none


Gms-workspace-symbolic-location
A symbol that specifies a point on the workspace.
Allowable values:
top-left-corner, top-center, top-right-corner, right-center, bottom-right-corner, bottom center, bottom-left-corner, left-center, center
Default value:
none


Gms-workspace-x-location Gms-workspace-y-location
A coordinate pair, implemented as two integer attributes, that specifies a point on the workspace.
Allowable values:
Any two integers
Default values:
none


Gms-workspace-x-offset Gms-workspace-y-offset
A coordinate pair, implemented as two integer attributes, that specifies an offset from a workspace location.
Allowable values:
Any two integers
Default values:
none


Gms-allow-for-menu-bar
A truth-value specifying whether to consider the presence of the menu bar displayed on the window. If set to true, all window location specifications relative to the top of the window (top-left, top-center, or top-right) are considered relative to the bottom of the menu bar.
Allowable values:
true or false
Default value:
false

The rest of this section shows you how to use these attributes to tell GMS what workspace to display and how to display it.

Specifying the Workspace to Display

To specify the workspace to display:

To select the workspace to display, GMS first searches all named workspaces, then all items that have subworkspaces, then all items on workspaces, and displays the first matching workspace that it encounters. If GMS cannot find a matching workspace, it signals an error.

Specifying the Display Scale

To specify the scale at which to display the workspace:

If you specify a float, G2 displays the workspace scaled by that value, up to a maximum of 4.0 times its normal size. Specifying 1.0 displays the workspace at normal size. Specifying none displays the workspace at the scale at which it was most recently displayed, or at normal size if the workspace has never been displayed.

Specifying a GMS-view-scale value has the same effect as specifying the scale in a show workspace scaled by scale action.

Specifying the Workspace Location

Except for Gms-display-target and Gms-view-scale, all Show Workspace template attributes exist to tell G2 where to display the workspace. This section refers to such attributes as location attributes.

Despite the multiplicity of location attributes, the information G2 needs is actually simple: one point on the G2 window, and one point on the workspace. G2 displays the workspace so that the two specified points appear at the same location on the screen. This section refers to the two points as display points.

You can specify display points in two different ways:

The two specification techniques work in the same way for windows and for workspaces. You can specify one display point symbolically and the other numerically, or you can use the same technique for both.

Conflicting Display Point Specifications

The possibility of specifying a display point symbolically or numerically permits you to give conflicting specifications. To prevent ambiguity, a symbolic display point specification takes precedence over a numeric specification.

Missing Display Point Specifications

If you specify a window display point symbolically, and do not specify a workspace display point, the workspace display point defaults to the window display point.

In all other cases, if you fail to supply both a window display point and a workspace display point, the workspace appears where it did the last time it was displayed. If the workspace was never displayed, G2 provides default window and workspace display points.

Specifying a Display Point Symbolically

You can specify a window or workspace display point symbolically by giving one of the values top-left-corner, top-center, top-right-corner, right-center, bottom-right-corner, bottom center, bottom-left-corner, left-center, or center. Each of these describes a point along the edge, or at the center, of the window or workspace.

To specify a window display point symbolically:

To specify a workspace display point symbolically:

If you specify either display point as none (the default), GMS looks for a numeric specification of that display point.


Note: To keep the current menu bar visible while displaying other workspaces relative to the top of the window, use a template's gms-allow-for-menu-bar attribute.

Specifying a Display Point Numerically

You can specify a window or workspace display point numerically by giving a pair of integers that designate the X and Y coordinates of the point. GMS looks for a numeric specification of a display point only when the symbolic specification for that point is none.

To specify a window display point numerically:

To specify a workspace display point numerically:

If you specify either coordinate as none, GMS treats both positions as being none, and obtains a default display point from G2.

Specifying a Location Offset

You can modify a display point specified symbolically or numerically by specifying a numeric offset. The offset consists of a pair of integers. One specifies an X offset, the other a Y offset.

When you specify an offset to a symbolic display point, GMS first converts the location to equivalent X and Y coordinates. When you specify an offset to a numeric display point, GMS already has the X and Y coordinates.

To implement an offset, GMS adds the X and/or Y offsets to the X and/or Y coordinates of the original display point. GMS uses the result as the display point.

To specify a window display point offset:

To specify a workspace display point offset:

You specify either or both offsets as none. The effect is the same as if you had specified the offset as 0.

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

Copyright © 1997 Gensym Corporation, Inc.