Skip to Content

Gradient effects

Estimated Reading Time: 2 Minutes

One of the many new features of the Graphical User Interface released with version 2018 R1 is the capability to provide to a Window control of Gradient effects.

This capability comes as a property of the Window control and has three components:

Gradient-Color-1
This property allows you to set or retrieve the start color of the gradient effect of the Window control.
If this property is not set, but Gradient-Color-2 is set, then the start color of the gradient effect is black.
The gradient effect overrides the color set by Background-Color.

Gradient-Color-2
This property allows you to set or retrieve the end color of the gradient effect of the Window control.
If this property is not set, but Gradient-Color-1 is set, then the end color of the gradient effect is black.
The gradient effect overrides the color set by Background-Color.

Gradient-Orientation
This property allows you to set or retrieve the orientation of the gradient effect of the Window control, Possible values are:

None
0: NORTH-TO-SOUTH
1: NORTHEAST-TO-SOUTHWEST
2: EAST-TO-WEST
3: SOUTHEAST-TO-NORTHWEST
4: SOUTH-TO-NORTH
5: SOUTHWEST-TO-NORTHEAST
6: WEST-TO-EAST
7: NORTHWEST-TO-SOUTHEAST

Constants for the above values are provided in the isgui.def copybook.
If this property is not set, the default orientation is North to South.

Example
Display a standard window whose background color goes from gray to white

    working-storage section.
    77 window-handle usage handle of window.
    ...
    procedure division.
    ...
      display standard  window background-low 
              screen line 41 
              screen column 91 
              size 64.0 
              lines 55.8 
              cell width 10 
              cell height 10 
              label-offset 20 
              control font Default-Font
              gradient-color-1 rgb x#c0c0c0 
              gradient-color-2 rgb x#ffffff 
              gradient-orientation 0 
              resizable 
              modeless 
              title-bar 
              no wrap 
              title "Screen" 
              handle window-handle

The TRANSPARENT style, previously available only on label controls, is now supported on check-box, radio-button and frame controls as well. This allows the creation of user interfaces with gradients as background colors.
Attached you will find a sample program that applies all the different possible orientations

Gradient effects
  • Attached Files
  • gradient.cbl (8.88 KB) 9