GUI ScreenIO for Windows

 ScreenIO.com


How to Use Progress Bar Controls in Your Program

Your COBOL field definitions reside in the -4 portion of the panel copybook.  For a progress bar, the field definition consists of a simple PIC 9(3) field.

 01 panel-4.
      .
      .
     05 MY-PROGRESS-BAR   PIC 9(3) VALUE 0.

A progress bar displays a bar in the range of 0 to 100, so you just move the desired value to the progress bar field.  In the screen shot below, we entered 67 in the edit control, and all of the progress bars display a bar that's 67 percent of the control.

In your application, you'd calculate your percentage of completion and update the progress bar every so often so that the user can see something is happening.  Typically you would update it only if the progress value actually changed.

For those of you who are percentage-challenged, the formula for calculating percentage is:

     COMPUTE WORK-PERCENT = 
             (CURRENT-RECORD / TOTAL-RECORDS) * 100

     IF WORK-PERCENT NOT = MY-PROGRESS-BAR
       MOVE WORK-PERCENT TO MY-PROGRESS-BAR
       SET panel-DO-DISPLAY-AND-RETURN
       CALL 'GS' USING panel-1
                       panel-2
                       panel-3
                       panel-4
     END-IF

Related topics:


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom