Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : VIEW-AS phrase
 

VIEW-AS phrase

Defines a compile-time defined (static) widget to represent a field or variable on the screen.
Note: Does not apply to SpeedScript programming.

Syntax

VIEW-AS
{ combo-box-phrase
| editor-phrase
| FILL-IN
[ NATIVE ]
[ size-phrase ]
[ TOOLTIP tooltip ]
| radio-set-phrase
| selection-list-phrase
| slider-phrase
| TEXT
[ size-phrase ]
[ TOOLTIP tooltip ]
| TOGGLE-BOX
[ size-phrase ]
[ TOOLTIP tooltip ]
}
Use the following syntax to specify the type of widget to use for displaying values in a browse column:
VIEW-AS combo-box-phrase | TOGGLE-BOX
combo-box-phrase
Specifies that a field or variable is viewed as a combo box widget. You can use a combo box to represent a value of any data type. This is the syntax for combo-box-phrase:
VIEW-AS COMBO-BOX
  [ LIST-ITEMS item-list | LIST-ITEM-PAIRS item-pair-list]
  [ INNER-LINES lines ] [size-phrase ] [ SORT ]
  [ TOOLTIP tooltip]
  [ SIMPLE | DROP-DOWN | DROP-DOWN-LIST ]
  [ MAX-CHARS characters ]
  [ AUTO-COMPLETION [ UNIQUE-MATCH ] ]
Use the following syntax to specify a combo-box widget for displaying values in a browse column:
COMBO-BOX
  [ LIST-ITEMS item-list | LIST-ITEM-PAIRS item-pair-list]
  [ INNER-LINES lines ] [ SORT ]
  [ DROP-DOWN | DROP-DOWN-LIST ]
  [ MAX-CHARS characters ]
  [ AUTO-COMPLETION [ UNIQUE-MATCH ] ]
Note: In a character interface, browse columns are always displayed as fill-in widgets no matter what VIEW-AS option you specify.
For more information, see the COMBO-BOX phrase reference entry.
editor-phrase
Specifies that a CHARACTER or LONGCHAR field or variable is viewed as a text editor widget. A text editor widget supports cut, paste, word-wrap, and auto-indent features. This is the syntax for editor-phrase:
EDITOR
  {     size-phrase
     |  INNER-CHARS char INNER-LINES lines
  }
  [ BUFFER-CHARS chars ]
  [ BUFFER-LINES lines ]
  [ LARGE ]
  [ MAX-CHARS characters ]
  [ NO-BOX ]
  [ NO-WORD-WRAP ]
  [ SCROLLBAR-HORIZONTAL ]
  [ SCROLLBAR-VERTICAL ]
  [ TOOLTIP tooltip ]
For more information, see the EDITOR phrase reference entry.
FILL-IN [ NATIVE ] [ size-phrase ]
Specifies that the field or variable is viewed as a fill-in widget. In a fill-in field, the literal value of the field or variable is displayed. On update, the user types the literal value into the fill-in field.
You can specify FILL-IN for any CHARACTER, INT64, INTEGER, DECIMAL, DATE, DATETIME, DATETIME-TZ, or LOGICAL value (with or without extents). FILL-IN is the default representation for those values.
Note that Windows allows a user to transfer focus to the fill-in field by pressing ALT and one of the letters in the label. For more information on specifying a label using the LABEL option, see the Format phrase reference entry.
If you specify NATIVE, then the field behaves like a native fill-in field under the current user interface. A non-NATIVE field behaves like a default ABL fill-in field under any interface. Native fill-in fields provide better consistency with other applications in graphical environments, but do not support some ABL constructs such as the UPDATE statement with the TEXT option or the CHOOSE statement.
When a non-NATIVE (ABL) fill-in is disabled, the border disappears, but the text does not gray out. When a NATIVE fill-in is disabled, the text grays out.
Like the other static widgets that can be defined using the VIEW-AS phrase, you can specify ToolTips for the fill-in widget using the TOOLTIP option.
radio-set-phrase
Specifies that the field or variable is viewed as a radio set widget. A radio button set is a series of buttons, of which only one can be TRUE at a time. When the user sets one of the buttons to TRUE, the others are set to FALSE. You can specify a radio-set-phrase for any group of CHARACTER, INT64, INTEGER, DECIMAL, DATE, or LOGICAL values (with or without extents). This is the syntax for radio-set-phrase:
RADIO-SET
  [ HORIZONTAL [ EXPAND ] | VERTICAL ]
  [ size-phrase ]
  RADIO-BUTTONS label , value [ , label, value ... ]
  [ TOOLTIP tooltip ]
Note: If two or more buttons of a radio set use the same label, the AVM uses only the value of the first button.
For more information, see the RADIO-SET phrase reference entry.
selection-list-phrase
Specifies that the field or variable is viewed as a selection list widget. You can only specify the selection-list-phrase for a character-string value. A selection list is a scrollable list of CHARACTER values. If the field is enabled for input, the user can select one or more values from the list. This is the syntax for selection-list-phrase:
SELECTION-LIST
  [ SINGLE | MULTIPLE ]
  [ NO-DRAG ]
  [ LIST-ITEMS item-list ]
  [ SCROLLBAR-HORIZONTAL ]
  [ SCROLLBAR-VERTICAL ]
  { size-phrase | INNER-CHARS cols INNER-LINES rows }
  [ SORT ]
  [ TOOLTIP tooltip ]
For more information, see the SELECTION-LIST phrase reference entry.
slider-phrase
Specifies that the field or variable is viewed as a slider. Specify the slider-phrase for an integer value only. A slider is a graphical representation of a numeric range. It is composed of a rectangular area that contains a trackbar. You can change the current value within a defined range by moving the pointer that resides on the trackbar. This is the syntax for slider-phrase:
VIEW-AS SLIDER
  MAX-VALUE max-value MIN-VALUE min-value
  [ HORIZONTAL | VERTICAL ]
  [ NO-CURRENT-VALUE ]
  [ LARGE-TO-SMALL ]
  [ TIC-MARKS
      { NONE | TOP | BOTTOM | LEFT | RIGHT | BOTH }
      [ FREQUENCY n ]
  ]
  [ TOOLTIP tooltip ]
  [ size-phrase ]
For more information, see the SLIDER phrase reference entry.
TEXT [ size-phrase ]
Specifies that the field or variable is viewed as read-only text. In a graphical environment, a text field takes up less space on the screen than a native fill-in field.
You can specify TEXT for any CHARACTER, INT64, INTEGER, DECIMAL, DATE, or LOGICAL value (with or without extents).
TOGGLE-BOX [ size-phrase ]
Specifies that the field or variable is viewed as a toggle box widget. A toggle box is a small box that is either marked or not marked to indicate a TRUE or FALSE value, respectively. You can specify TOGGLE-BOX for any LOGICAL value, or any calculated value whose expression evaluates to a LOGICAL value.
Note that Windows allows a user to select a toggle-box item by pressing ALT and one of the letters in the side label. For more information on specifying a label using the LABEL option, see the Format phrase reference entry.
For toggle-box browse columns, the toggle-box always appears whether it is enabled or not. A solid outline appears to indicate that a cell in a toggle-box column currently has focus. The toggle-box is always centered within the column. You cannot specify size-phrase for toggle-box browse columns.
Note: In a character interface, browse columns are always displayed as fill-in widgets no matter what VIEW-AS option you specify.
TOOLTIP tooltip
Allows you to define a help text message for a toggle box. The AVM automatically displays this text when the user pauses the mouse over the toggle-box.
You can add or change the TOOLTIP option at any time. If TOOLTIP is set to "" or the Unknown value (?), then the ToolTip is removed. No ToolTip is the default. The TOOLTIP option is supported in Windows only.

Example

The following procedure defines a character variable and views it in succession as a text widget, a fill-in widget, an editor widget, and finally as a text widget again. The procedure shows that you can represent a character variable in several ways, as long as each representation appears in a separate frame.
r-viewas.p
DEFINE VARIABLE test AS CHARACTER NO-UNDO INITIAL "Now is the time"
  FORMAT "x(30)".

DISPLAY test VIEW-AS TEXT LABEL "Labels cannot be changed"
WITH FRAME a SIDE-LABELS.
PAUSE.

UPDATE test VIEW-AS FILL-IN LABEL "But fillins can, please enter a new value"
  WITH FRAME b SIDE-LABELS.

UPDATE test VIEW-AS EDITOR INNER-CHARS 16 INNER-LINES 2 MAX-CHARS 70
LABEL "As can editors, please enter a new value:"
WITH FRAME c.

DISPLAY test VIEW-AS TEXT FORMAT "x(70)" LABEL "The final value is:"
WITH FRAME d.
For additional examples, see the COMBO-BOX phrase, EDITOR phrase, RADIO-SET phrase, SELECTION-LIST phrase, and SLIDER phrase reference entries.

Notes

*To create a static widget, you must define a static frame that contains the widget. Each frame you define that contains the widget creates an additional instance of that widget for the underlying field or variable. The handle for a static widget is not available until the widget is created.
*You can also use the VIEW-AS option in the Frame phrase and MESSAGE statement to indicate a dialog box and alert box, respectively.
*In Windows, if no font is specified for a fill-in field, ABL uses two default fonts:
*A fixed font for date fields, numeric fields, and character fields that contain fill characters (such as the parentheses surrounding the area code of a telephone number).
*A proportional font for character fields that do not contain fill characters.
The AVM looks for these fonts in the current environment, which may be the registry (Windows only) or an initialization file. If the current environment does not define these fonts, the AVM uses the system default fixed and proportional fonts. For more information on environments, see OpenEdge Deployment: Managing ABL Applications.

See also

COMBO-BOX phrase, EDITOR phrase, RADIO-SET phrase, SELECTION-LIST phrase, SIZE phrase, SLIDER phrase