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

Type-in Boxes

A type-in box lets you enter values from the keyboard. G2 uses what you enter as the new value of the variable or parameter that you associate with the type-in box. Here are several type-in boxes, representing several symbolic variables:


Type-in boxes are specific to the variable or parameter type they represent. G2 does not permit you to enter a value of the wrong type. For example, if you try to enter text into a type-in box that is assigned to a float variable, the variable retains its previous value, and G2 signals an error.

Specifying the Activation Value

The Value-on-activation attribute indicates what value, if any, appears in the type-in box upon activation. The value could be any value of the appropriate type for the variable or parameter that the type-in box represents.

If you do not specify a value in the Value-on-activation attribute and the variable or parameter has an initial value, that value appears when the type-in box is activated.

If the type-in box represents... Then when activated...
A variable that does not have an initial value
Asterisks appear in the box.
A parameter that does not have a user-specified initial value
The datatype specific default initial value appears in the box.

As soon as the variable or parameter for the type-in box receives a value, G2 replaces the asterisks or the default datatype value with the new value. The size of the type-in box increases or decreases to accommodate the current value.

Specifying the Formatting Style

The Format-for-type-in-box attribute specifies the format in which to display the value. The default value is default, indicating that G2 displays the value in the appropriate format for the datatype of the variable or parameter.

For representing quantity and float variables and parameters, you can enter any ddd.dddd format, which indicates the precision of the value on either side of the decimal point, where a d represents each digit.


Tip: If you enter a value that exceeds the specified format, G2 displays it as an exponential value.

Defining the Selection Status

The Blank-for-type-in? attribute defines whether to clear the type-in box when you select it. The default value of yes automatically deletes any value when you click in the box to enter a value. Changing the default to no maintains the previous value, which you can then edit.

Specifying Editor Options

The Have-edit-option-buttons-for-type-in? attribute specifies whether certain Text Editor buttons appear with the type-in box when you select it to change its value. The default is no.

Changing the default to yes displays edit option buttons when you click in the type-in box. The next example show the Text Editor buttons that appear after pressing a space character after the name.


Class-Specific Attributes

The class-specific attributes of type-in boxes are:

Attribute Description
Value-on-activation
The value, if any, that appears in the box when the type-in box is activated.
Allowable values:
Any appropriate value for the variable or parameter being represented.
Default value:
none


Format-for-type-in-box
Determines the format in which to display the value.
Allowable values:
any ddd.dddd-format
default

Default value:
default


Blank-for-type-in?
Determines whether G2 clears the type-in box when a user selects it.
Allowable values:
yes
no

Default value:
yes


Have-edit-option-buttons-for-type-in?
Determines whether limited Text Editor buttons appear for editing.
Allowable values:
yes
no

Default value:
no

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

Copyright © 1997 Gensym Corporation, Inc.