Using the Draw method
The Draw method allows you to draw text, lines, patterns, pictures and geometric shapes on windows, controls, and printer pages. It takes an argument which comprises one or more phrases which each start with a keyword indicating the operation to perform, followed by the arguments to that operation. (see the workspace 10 HELPDRAW for examples).
Drawing takes place using a current Pen (for foreground drawing) and Brush (for background drawing). You can also set the Mode which determines how drawing interacts with what is already on the screen.
Coordinates are interpreted according to the current Draw-method Scale for the object. The first time that the Draw method is used on a control, this is set to be the same as the scale property of the control. However, you can change it to be either one of the standard fixed scales, or to be proportional to the window size.
APLX automatically handles window refreshing for you if the window is uncovered or resized (you can switch this off using the autoredraw property). It does this by storing the sequence of Draw commands applicable to the window or control, and replaying them when an update is required. You can also group a series of commands together, and selectively enable or disable them (for example, to temporarily hide the labels on a graph), or delete them altogether from the saved sequence. This is useful for animation effects.
The general syntax of the Draw method is:
Control.Draw '<Keyword>' Arg1 Arg2...
where Control is usually the a reference to the Window into which you want to draw, or a Printer, or a Frame, Picture or Image object, identified using dot notation (for example,
Control.Draw ('<Keyword1>' Arg1) ('<Keyword2>' Arg1 Arg2)...
Alternatively, you can use the equivalent
ControlName ⎕WI 'Draw' '<Keyword>' Arg1 Arg2... ControlName ⎕WI 'Draw' ('<Keyword1>' Arg1) ('<Keyword2>' Arg1 Arg2)...
where ControlName is a character vector containing the name of the window or control (including parent if applicable), for example:
The keywords are not case-sensitive, but it is recommended that you enter them in the case shown in the following sections.
The operations you can carry out using the Draw method fall into four categories:
In the descriptions which follow, optional parameters are shown in square brackets.
Copyright © 1996-2010 MicroAPL Ltd