Coordinate Space Solutions

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, 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 run-time system 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 run-time system lay out the screen accordingly. For details on the CELL phrase, see Format 11 DISPLAY FLOATING WINDOW.

Note: When you change the coordinate space, you affect both the text and graphical layers. Because of this, you have some restrictions if you are going to use the text layer. In particular, you may not make a cell smaller than a character, nor may you make it wider than a character (it can be taller).

Here are some general guidelines to apply when deciding how to set up your coordinate space:

Note: Pixel coordinates are relative to the size of the target window. The lowest legal value is '1', and the highest legal value is equal to the largest resolution covered by the target window. If that value is exceeded, the property defaults to the closest legal value.

It is important to set your coordinate space early in your work. If you lay out screens and then change the coordinate system, all of your previously designed screens will have to be reworked.

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. See The Character Coordinate Phrases for a discussion of these phrases.