Writing formatted data into a window

put

Write formatted data into a window


SYNTAX

put expression[:format] [, expression[:format]]… [font = font_style] \
          [bgc = rbg_value] [fgc = rbg_value] [pen = pen_no] [in window_id]

Writes formatted data into a window. Each expression is evaluated and then output to the window starting at the window’s current logical cursor position. The data is contained within the window specified, wrapping to the next line if necessary. The cursor is positioned by means of the move cursor to | at command.

Items may be separated either by a comma or by a semicolon. If a comma is used, the value of the Sculptor system variable sys.Separator is output in place of the comma. If a semicolon is used, no separator character is output between the items.

Unless the last item in the list is terminated by a comma or semicolon, the window cursor is positioned on the next row. If the last item is terminated by a comma, the separator character is output. If it is terminated by a semicolon, the window cursor is positioned after the last item.

The default separator character is the comma (,), but it may be redefined to another character or to multiple characters by assignment to the Sculptor system variable sys.Separator.

[:format]

Each expression may, optionally, have a format attached. The format is preceded by a colon. It is normally a string constant in quotes, but may be an alphanumeric field containing a valid Sculptor format.

If no format is specified, a suitable format for the data type of the expression is used. In the case where expression is a simple field_id, the default format is the format of this field.

See Field formats.

[font = font_style]

If present, this clause specifies the font to be used for the display of the data. See Fonts for details of the structure of a font definition.

[bgc = rbg_value]
[fgc = rbg_value]

If present, these clauses define RGB values for the foreground and background colours to use for the data. RGB colours were introduced in Sculptor 5 and should be used in preference to pen clauses (though pens are still supported). See Colours.

[pen = pen_no]

If present this clause specifies a pen from the window palette to be used to write the data. If the clause is absent the pen which was last set by the setpen command is used. This command sets the pen to be used in all subsequent put commands which do not have a pen = clause. The initial value for this default pen is PEN_NORMAL (21).

[in window_id]

If the in window_id clause is present the data is written to the window specified. The window need not be visible.

If the in window_id clause is absent, the window which was the subject of the last move cursor to | at command (which positions the window cursor) is selected. If no move cursor to | at command has yet been executed in the program, the task window is used.

It is recommended that the window_id always be specified.

If the put command appears in a !report section, and no window_id is specified, the data is written to standard output (normally the terminal).


NOTES

  • If an alphanumeric field has the r flag, and the length of the data is less than the field length, the field is written as stored, preserving the field length, rather than padding with spaces.

  • Text displayed by put is cleared by the clearall command but not by the clear command.

  • Since Sculptor version 6.1.0 the put command sends the output to stdout on nph-srep.


EXAMPLE

put "Page "; tostr(tmp.PageNo, ""); " of "; \
     tostr(tmp.Npages) pen = 32 in ScrollWindow

RELATED TOPICS

sys.Separator

setpen

move cursor to | at