


Ideally, you want the majority of your positioning coordinates to be integer values. This is easier to work with and improves portability. While you will undoubtedly encounter cases where you need to use non-integer coordinates, their use should be minimized.
The simplest solution is to use the same font for your graphical objects as you use in the text layer. Then, if you also use unboxed entry fields, you have eliminated both trouble points. The problem with this solution is that it looks wrong when compared to other graphical programs; the font is fixed-pitch and the boxes are missing.
A more sophisticated solution is to change the way that coordinates are measured. If you can set the coordinate space so that your controls fall on integral coordinates, then the problem is solved. ACUCOBOL-GT provides a way to do this. When you create a window (including the main application window), you can set its cell size with the CELL phrase of the DISPLAY WINDOW verb. When you do this, you specify your own line and column sizes. The phrase allows you to have the runtime measure a graphical object and set the coordinate space appropriately. Typically, you would measure an entry field with the font you want to use and have the runtime lay out the screen accordingly. For details on the CELL phrase, see the DISPLAY FLOATING WINDOW verb in section 6.6, Book 3, "Reference Manual."
1. If you plan to mix graphical objects with classical textual displays, use the default cell size that is the size of the text-layer font. In this case, the overriding consideration is the placement of the text in cells. The graphical objects will have to be specified with whatever coordinates work. You should try to keep the number of graphical objects to a minimum, or consider converting to an entirely graphical screen if you want to mix in a large number of graphical elements.
2. If you anticipate using entry fields heavily (as would be typical in a conversion of a text-based application), you should set up the coordinate space based on the size of an entry field. This makes the placement of label/entry-field pairs very easy. Note that the CELL phrase allows you to specify OVERLAPPED (vertically adjacent entry fields share a common border) or SEPARATE (a little space placed between entry fields). You can choose whichever style you think looks better. Here is an example CELL phrase:
CELL SIZE = ENTRY-FIELD FONT MY-FONT, SEPARATE
3. If you will be using a mix of graphical objects, but only a few entry fields, you should base the coordinate space on the size of a label. This lets you measure with the correct font, but ignores the overhead associated with entry fields. This setting is closest to what other graphical-design systems use (typically, these use a coordinate cell size that is some fraction of the size of the system's font). A typical CELL phrase would be:
CELL SIZE = LABEL FONT MY-FONT
Another way to get the same result is to use the GRAPHICAL phrase with the DISPLAY WINDOW verb. For example:
DISPLAY STANDARD GRAPHICAL WINDOW
4. If you want to compute exact pixel coordinates (for very specialized displays), you should use a cell height and width of "10". Then each tenth of a cell (".1") corresponds to one pixel.
A sample DISPLAY statement would look like this:
DISPLAY PUSH-BUTTON LINE 300 PIXEL(S)
COL 225 PIXEL(S)
LINES 30 PIXEL(S)
SIZE 120 PIXEL(S).
Because of the fundamental differences in the coordinate systems of character and graphical systems, ACUCOBOL-GT provides two sets of statement phrases with which to specify control size and positioning. For a discussion of these phrases, see Chapter 3, section 3.6, "Character Coordinates."