ContentsIndexPreviousNext

5.2 Global Styles

There are several styles that apply to all controls. These styles include:

NO-TAB This style causes a "Tab" or "Backtab" key press to skip the control. Normally, while the program is performing a Screen Section ACCEPT, when the "Tab" or "Backtab" key is pressed, the next or previous element in the Screen Section is activated. Specify NO-TAB on controls that you want skipped when these keys are used. This style affects any key with the following editing actions: Default-Next, Erase-Next, Next, Numeric-Next, and Previous. When the program responds to key presses that correspond to the above editing actions, it will not activate any control that has the NO-TAB style.

PERMANENT A permanent control is one that can be destroyed only by the DESTROY verb, or by destroying the window that contains it. By default, controls are permanent. The default can be changed with the TEMPORARY-CONTROLS runtime configuration variable.

Permanent controls are more efficient than temporary controls (see TEMPORARY below). The PERMANENT style is applied to a control when it is created and does not change during the life of that control, even if you try to change it later by modifying the control's style.

TEMPORARY A temporary control will self-destruct when its home location is overwritten by another control or textual output. Temporary controls can also be destroyed in the same manner as permanent controls.

A temporary control self-destructs when:

1. another control is created in the exact same location.

The runtime maintains location information to the nearest 100th of a character cell. If the newly created control is placed in the same row and column as a temporary control (or less than one one-hundredth of a cell away), it will destroy that temporary control. Note that moving a control on top of a temporary control does not destroy the control (the runtime assumes that the temporary control is about to be moved, also. This occasionally happens with Screen Section updates when several items are of variable size). Only a newly created control can destroy a temporary control.

2. textual output is placed in the same character cell as the temporary cell's home location.


Note that BLANK SCREEN will destroy all temporary controls in a window.
The temporary style is applied when a control is first created and does not change during the life of the control. If you attempt to apply both the PERMANENT and TEMPORARY style to a control, the PERMANENT style is used.

HEIGHT-IN-CELLS Normally, the height of a control is expressed in control units. Each control defines its own meaning for these units. Typically, a control that is n units high will be exactly big enough to hold n lines of text. This allows you to specify the size of a control in logical terms without having to know its exact physical representation on the screen. The HEIGHT-IN-CELLS style overrides this behavior. Instead of using control units, you specify the height of the control exactly, using the cell size of the owning window as the base unit. Thus, a height of one (1) would cause the control to be exactly one row tall.

This option is especially useful in sizing frame control objects. The style allows you to specify the frame's exact dimensions without having to know anything about the frame's title font.


Note that you can also specify this style with the CELLS option of the LINES phrase. For example:

LINES = 15 CELLS.

Also note that this style is not intended for use in combination with a control's default height. Default heights are based on control units and when based on character cells do not typically produce useful results.
WIDTH-IN-CELLS This option is analogous to HEIGHT-IN-CELLS, except that it affects the width of a control. This style is particularly useful when you want to center a label over a region of the screen. By specifying the label's width in cells, and using the CENTER label style, you can easily do the centering without knowing anything about the label's font. For example, if you have a window that is 40 columns wide, and you want to center a title in it, you could use:

DISPLAY LABEL MY-TITLE, COLUMN 10,
  SIZE 20 CELLS, CENTER

Assuming that the title would fit in 20 cells, this will work for any title in any font.

OVERLAP-LEFT This style causes the control to be shifted a small amount to the left from its specified position. The amount is equal to the width of the control's border. This shifting occurs when the control is created or moved. If the control does not have a border, no shifting occurs.

The purpose of this style is to simplify placing several similar controls in a row. For example, if you have a series of adjacent push buttons, the normal appearance would be to draw each push button exactly touching each other. This causes a double border to appear between the push buttons. By shifting each one slightly to the left, you can have the borders overlap and achieve a more uniform appearance with a single border between the buttons. Most applications that have adjacent push buttons do this. You can create the same effect by manually positioning the controls with overlapping borders, but using this style is easier and more portable because you don't need to know exactly how wide the borders are.

OVERLAP-TOP This style is similar to the OVERLAP-LEFT style (see above), except that in this case the control is shifted slightly upward. The amount of the shift is determined by the height of the control's border. This style is useful when you want to create a series of controls that appear to be adjacent to one another in a single column.


Note that a way to achieve a similar effect with entry fields is to use the OVERLAPPED option on the CELL SIZE phrase of the DISPLAY FLOATING WINDOW verb. This method is usually easier to employ than the OVERLAP-TOP style applied to each individual field, because it applies to the whole window.