Skip to main content

Demo - Using buttons in Dialog System

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

This Dialog System example illustrates how to get a button press returned to the COBOL program.

Resolution:

INTRODUCTION

============

This Dialog System example illustrates how to get a button press returned to the COBOL program.

SOURCE FILES:

=============

Program Files       Description

-----------------      -----------------------------------------------------------

NewSet.cbl           Modified generated COBOL program that processes buttons in a dialog.

Copy Files:

=======

Newset.cpb          Generated copy book for screenset.

OPERATION:

==========

To learn how this example was created edit NewSet.gs. You may have to open the file with Dialog System in order to do this.

Click Screenset (menu), Data block... (button). Two data items were added.

MY-OK-BUTTON            9    1.0  

MY-CANCEL-BUTTON    9    1.0

These items appear in the generated copy book NewSet.cpb.    

01 DATA-BLOCK.

     03 MY-OK-BUTTON                    PIC 9.

        88 MY-OK-BUTTON-TRUE            VALUE 1.

     03 MY-CANCEL-BUTTON                PIC 9.

        88 MY-CANCEL-BUTTON-TRUE        VALUE 1.

Next, right mouse click anywhere on the background of the WIN-01 dialog and then click Dialog... (button). These two procedures were added to the dialog.

@MY-OK-BUTTON-PUSHED

     MOVE 1 MY-OK-BUTTON

     RETC

@MY-CANCEL-BUTTON-PUSHED

     MOVE 1 MY-CANCEL-BUTTON    RETC

Next, right mouse click on the OK button in the dialog and click Dialog... (button). The following code was added to cause the button click to branch to a procedure.

BUTTON-SELECTED  

     BRANCH-TO-PROCEDURE @MY-OK-BUTTON-PUSHED

Finally, right mouse click on the CANCEL button in the dialog and click Dialog... (button). The following code was added to cause the button click to branch to a procedure.

BUTTON-SELECTED

     BRANCH-TO-PROCEDURE @MY-CANCEL-BUTTON-PUSHED

In NewSet.cbl the following code was added to end of the Program-Initialize SECTION.

     move ZERO to my-ok-button my-cancel-button

Also, the following code was added to the end of the Program-body SECTION.

     if my-ok-button-true

         display 'OK button was pressed.'

         move ZERO to my-ok-button

     end-if

     if my-cancel-button-true

         display 'CANCEL button was pressed.'

         move ZERO to my-cancel-button

     end-if

Note that when a button is detected that the data block item is reset.

==========================================================

Keywords: demonstration, sample, example, demo, Dialog System, buttons.zip

demo.ex

demo.ne

Attachments:

buttons.zip

Old KB# 4213