uoutputbox (OutputBox)

The uoutputbox widget displays streaming text data. The data may come from a specified Output Channel, or be explicitly added. By default, it does not listen to any channel. Uniface provides a logical widget called OutputBox, which is mapped to uoutputbox.

For more information, see Specifying a Widget for a Field or Entity.

Widget Overview
Logical widget name: OutputBox
Maps to physical widget: uoutputbox
Default definition: OutputBox=uoutputbox(font=monosmall)
Use for: String fields
Supported triggers: None, the addLine and getContent widget operations are supported to manipulate the widget content. See Widget Operations.
Supported properties: See Widget Properties
Supported in egrid(Grid) widget? No
Supports MSAA? : Yes, for testing purposes only. For more information, see Accessibility.

Description

The uoutputbox widget is useful for displaying messages and process output. It can automatically stream information from the Compiler Output channel, Putmess channel, or Message Line channel, as determined by the Output Message property.

It is also possible to manually add text messages to the widget. To do so, you can do one of the following:

  • Assign a string to the field value (and then use the show command to synchronize the display)
  • Use the widget operation addLine(), which has the advantage of being immediately (synchronously) processed.

The Uniface line break symbol %%^ is interpreted. For example:

"This is a veryyyyyyy long line%%^And this comes at the next line"

is displayed as:

This is a veryyyyyyy long line
And this comes at the next line

As text is streamed in, the widget scrolls to display the last line, adding horizontal and vertical scrollbars as necessary. The widget has no awareness of the current line—there is only one active line and that is always the last line. The last line is available in the field value and can be read from ProcScript.

The complete content can be read using widget operation getContent.

The uoutputbox widget supports Unicode and the standard Uniface field colors. How the color is handled depends on the underlying window system.

Printing is not supported, but you can use the getContent widget operation to copy the content to a variable, which you can then send to a log file or other output.

To clear the widget, clear it's parent entity.

Widget Properties

Output Box Properties
Property Technical Name Dynamic?
3-D Effect (3d) 3D No
Attach to Window Border (attach) attach Yes
Background Color (BackColor)

BackColor

Yes

Bottom Line (BottomLine)

BottomLine Yes
Draw 3-D Frame Outside (DrawOutside) DrawOutside No
Foreground Color (ForeColor) ForeColor Yes
Frame Frame No
Label Font (LabelFont) labelfont Yes
History Size history No
Output Channel (MsgChannel) msgchannel Yes
Tool Tip Text (ToolTipText) ToolTipText Yes
Vertical Scroll Bar (VScroll) VScroll Yes
Widget Font (Font) Font No
Attach Margin (AttachMargin) AttachMargin Yes
Popup Rectangle (PopupRect) PopupRect Yes

Widget Operations

The uoutputbox widget has widget operations that can be called in ProcScript to manipulate the contents of the widget, without changing the field's value. To call these operations, use the $widgetoperation with a field handle (obtained by $fieldhandle). For more information, see $widgetoperation .

The Output Box has the following widget operations:

  • addLine—add a string to the Output Box.

    Syntax: $fieldhandle(Field)->$widgetoperation(""addLine", "LineContent")

  • getContent—copy the current content of the Output Box into a variable (Output). The output consists of a Uniface list in which each item is a line in the Output Box.

    Syntax: $fieldhandle(Field)->$widgetoperation("getContent", Output)

Keys and Macros

The output box widget uses standard keyboard keys for navigation through the data. .

Navigation Keys
Key Action
Up and Down arrows Scroll data one line at a time
Page Up

Page Down

Scroll data one page at a time. (A page is equal to the size of the control.)
Ctrl+Home Move to top of data
Ctrl+End Move to end of data
Macros
Macro Action
^Save Puts the complete content on the clipboard.
^Zoom Zoom field
^Remfield Allows the user to save the data in a UTF8-formatted file.

Example: Connecting the Output Box to the Putmess Channel

The following code redirects the putmess output to the output box. Whenever code calls the putmess statement, this text is also sent to the uoutputbox. No additional code required.

$fieldproperties("OUTPUTBOX_FIELD")="msgchannel=2"

Example: Procedurally Adding Messages to the Output Box

The following example adds a message to the uoutputbox using the addLine widget operation:

entry report
variables
  handle vHandle
endvariables
  vHandle = $fieldhandle("OUTPUTBOX_FIELD")
  forentity "MYENT"
    if (FLD1.MYENT > FLD2.MYENT)
      vHandle->$widgetoperation("addLine", "Error: FLD1 is bigger than FLD2")
    endif
  endfor
end