Creating the Button

After you have loaded the bitmaps, you can create the buttons. Bitmap buttons are created in the same manner as regular push buttons. See the DISPLAY Control-Type statement in Procedure Division Statements for more information. You turn a push button, check box, or radio button into a bitmap button by using the following styles and special properties:

BITMAP (style, required) This style informs the system that the button should be drawn as a bitmap button instead of a regular button. You must have this style set when the button is created, and you cannot change this style after the button is created.
BITMAP-NUMBER (numeric, special property, required) This property identifies which image in the bitmap strip will be used for this button. The first image in the strip is number 1 , the second number 2, and so on. If this value is set to zero, a blank button is displayed. If this number is a negative value, or higher than the number of images in the strip, the results are unpredictable. If a bitmap strip contains only one image, you should specify the number 1. Note that you can change which bitmap appears on a button by changing this value.
BITMAP-HANDLE (numeric, special property, optional) This property identifies which bitmap strip to use for the button. If you do not specify a bitmap handle, then the last bitmap loaded is used. If you specify a handle, the handle must hold a value returned by W$BITMAP when the bitmap was loaded. You can change bitmap strips after a button has been created by changing this value.

You may optionally use the following styles to affect the appearance of the buttons:

FRAMED (style, optional) This style requests that a frame be drawn around the button. Typically the frame is a thin black line. Note that not all systems support frames, in which case the request is ignored. By default, buttons are framed under Windows NT/Windows 2000.
UNFRAMED (style, optional) This style requests that the button be drawn without a frame. Not all systems support unframed buttons; on these systems the request is ignored. By default, buttons are not framed under Windows 98.
SQUARE (style, optional) This style is used only with framed bitmap buttons. It forces the button to have square corners. Without this style, the button will have slightly rounded corners. Not all systems support square buttons; on these systems the request is ignored.

The following Screen Section entry describes two default size bitmap push buttons:

01  SCREEN-1.
  03  PUSH-BUTTON, ROW 1, placeStateCOL 2, 
        BITMAP, BITMAP-NUMBER = 1.
  03  PUSH-BUTTON, OVERLAP-LEFT, 
        BITMAP, BITMAP-NUMBER = 2.

Specifying the OVERLAP-LEFT style on the second button causes the two buttons to share a border if they are framed. See Global Styles for more information. Note that this example assumes that you want to pull images from the last bitmap loaded in your program.

Here is a more complete example that creates six bitmap buttons. The first two buttons are push buttons, the third is a check box, and the final three are radio buttons. The styles and properties used are appropriate for grouping the buttons into a toolbar. Note that the toolbar.cbl sample program does this.

* Screen Section
01  TOOLS-1. 

  03  PUSH-BUTTON, placeStateCOL 2, 
        BITMAP, BITMAP-NUMBER = 1, 
        EXCEPTION-VALUE = 101. 

  03  PUSH-BUTTON, OVERLAP-LEFT, 
        BITMAP, BITMAP-NUMBER = 2, 
        EXCEPTION-VALUE = 102. 

  03  placeCityCHECK-BOX, StateCOL + 2, BITMAP, 
        BITMAP-NUMBER = 3, NOTIFY, 
        EXCEPTION-VALUE = 103. 

  03  placeCityRADIO-BUTTON, StateCOL + 2, BITMAP, 
        BITMAP-NUMBER = 4, NOTIFY, 
        EXCEPTION-VALUE = 104. 

  03  RADIO-BUTTON, OVERLAP-LEFT, 
        BITMAP, BITMAP-NUMBER = 5, 
        NOTIFY, EXCEPTION-VALUE = 105. 

  03  RADIO-BUTTON, OVERLAP-LEFT, 
        BITMAP, BITMAP-NUMBER = 6, 
        NOTIFY, EXCEPTION-VALUE = 106.