Coordinate Systems
Since the SYSGUI device contains so much information, two coordinate systems are needed:
-
Placement and manipulation of GUI objects such as the controls and the windows themselves.
-
Drawing and plotting commands. Each has its own set of customizable units.
In the default condition the two coordinate systems match up, but this can cease to be true even if the window is simply resized by the user. It is important to be aware of the two coordinate systems and how they work.
For clarity, this documentation refers to these two systems as CONTROL coordinates and DRAWING coordinates.
CONTROL Coordinates
All operations that manipulate GUI objects, such as controls and the windows that contain them, are performed with coordinates in the CONTROL coordinate system. CONTROL coordinates have their origin (0,0) at the upper-left corner of the window, and are initially measured in pixels, though there are three units of measure to choose from. The axes may be scaled by arbitrary multipliers (which need not even be integers), but the origin may not be translated.
CONTROL scaling and units are SYSGUI-wide parameters. If several windows are being created simultaneously, and the scaling or units are being changed, all sizes in the new mode are subsequently specified. In other words, these parameters are global and not dependent on the current context. Changing the scaling or units does not affect any data that has already been entered.
CONTROL Coordinates: Scaling and Units
By default, all CONTROL coordinates and dimensions are specified in pixels. The problem with this approach is that a window or dialog box that looks good in one display resolution might look bad on another, due to a different system font size. In order to make it easy to write portable GUI code, alternative units of measure are provided based on character size, as well as the ability to scale both axes.
The 'PIXELS', 'CHARS', and 'SEMICHARS' mnemonics select the current unit of measure in the CONTROL coordinate system, in which subsequent coordinates will be specified. The default units are 'PIXELS', which always match the display, dot for dot. When a program is moved to a system with a different system font, some GUI objects containing text (such as push buttons) might not look right if specified in pixels. 'CHARS' are always the width and height of a character cell in the current system font. 'SEMICHARS' are smaller units based on character cells. Contrary to what its name would suggest, a semichar is not half a character or even a quarter of a character. A semichar is defined as one quarter the width of a character and one eighth the height of a character. If chars or semichars are being used, the actual pixel coordinates and dimensions are adjusted to the font in use, as needed to compensate for the system font size.
The 'SCALE' mnemonic can be used to enter multipliers for CONTROL coordinates. For example, if a dialog box was entered using 'PIXELS', in order to realize the benefits of the automatic adjustment available when using 'CHARS' or 'SEMICHARS', use a 'SCALE' setting. (Using .5 for both XSCALE and YSCALE can convert pixels to semichars on some systems.)
DRAWING Coordinates
DRAWING coordinates are used to plot or draw into a SYSGUI window. By default, one unit equals one pixel, and the origin is at the upper left. (Note that there is an absolute unit of measure available. See the 'DRAWUNITS' mnemonic.) However, the axes can be translated, scaled, and reversed.