Drawing a rectangle

draw rectangle

Draw a rectangle


SYNTAX

draw rectangle width = width height = height [pen = pen_no] [pen = pen_no] [title = text_expression] [in window_id]

Draws a rectangle in the window specified, with the top-left hand corner at the window’s current logical cursor position. The cursor may be positioned by means of the move cursor to | at command. The clauses may appear in any order.

width = width
height = height

These values must both be supplied. If pixel positioning is in use the values are specified in pixels, otherwise in characters. Both width and height may be any type of expression that produces an integer value. Whatever the size of the rectangle, it is truncated at the edge of the window in which it is being displayed, within the border (if any).

[pen = pen_no]

If this clause is present, the specified pen from the window palette is used to draw the line. Otherwise the default pen PEN_LINE_GRAPHIC (34) is used.

[title = text_expression]

If present, defines a title to be displayed centred in the top line of the rectangle.

[in window_id]

If the in window_id clause is present the rectangle is drawn in the window specified. The window need not be open.

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

It is recommended that the window_id always be specified.


NOTES

  • The +|- graphic window clause defines an initial graphic in a window

  • Rectangles created by this command are cleared by the clearall command but not by the clear command.


EXAMPLE

A rectangle drawn with pen 15

draw rectangle width = 140 height = 80 pen = 15 in TestWindow

A rectangle drawn with the default pen

draw rectangle height = 180 width = 25 in Window2


RELATED TOPICS

draw hline, draw vline

fill rectangle

move cursor to | at

Draw operations

Graphics