Style

STYLE is a common property. The STYLE property holds a numeric value. This value is the sum of the numeric values of the individual styles that have been applied to a particular control. Styles affect the appearance or behavior of a control. For example, some of the styles that apply to a radio button include: BITMAP, FRAMED, and NOTIFY. Individual styles have a predefined numeric value (assigned in the file controls.def) and do not take any other value. A style can be applied or not applied. If the style is indicated in a statement, it is applied to the control; if it is absent, it is not applied. Most styles pertain to only a certain type of control, although a few are common to all controls.

There are two ways to specify a style for a control:

  1. Include the style name in the statement that creates the control
  2. Add the style's numeric value to any other style values that apply, and include the sum value in the STYLE IS style-flags phrase, where style-flags is the sum value

Including the style name in the statement that creates the control is the usual method for specifying a style. The collection of style names included in the statement (such as BITMAP and NOTIFY) instructs the Compiler to build the appropriate STYLE property value (the STYLE property is technically the method by which all styles are stored in the run-time system). However, there is an important restriction: the Compiler understands style names only when it knows what kind of control is being built. If you specify a control that has a variable (undefined) type, then you must specify styles with the STYLE IS style-flags phrase. In this case, you construct the STYLE property value by adding together the appropriate style numbers. Each style has a corresponding numeric value, and the STYLE property holds the sum of the specified styles. For example, if the numbers corresponding to BITMAP and NOTIFY were 1 and 4 respectively, the phrase STYLE IS 5 would specify those two styles. Each style's identifying number can be found in the file controls.def (they are level 78 items).

You can use the MODIFY statement to change a style value after a control has been created. However, in many cases the behavior of Windows, limits in the 32-bit Windows API, or restrictions in the ACUCOBOL-GT runtime, prevent a style change from taking effect. Exactly which styles can be effectively changed for each control is not known and is, therefore, not documented. When a style is known to be modifiable or not modifiable, that information is documented with the style. We recommend, however, that you test the behavior of your application in the target environment to confirm that style changes are handled in the way that you expect.