Author Topic: GUI Progress Bar  (Read 4685 times)


  • Rock Star
  • *****
  • Posts: 105
GUI Progress Bar
« on: May 01, 2007, 07:21:31 AM »
This isn't a question, it's more of a "trick" that many may already know, but some may not.

When running a GUI screen that processes a large quantity of data that tends to take a long time to traverse, your users may grow impatient when they don't know where the process is between start and finish.  In my travels I have come across a method you can use to show a graphic progress bar in the status line of your screen, providing a finished, professional-looking indicator to the user.  This is much better than the old-fashioned "xxx of yyyyy records processed" text.  This only works if you know the total number of records or items you're processing.

In the example below, I'll assume we're looping through a list of Purchase Orders. Before you begin processing the list, add the following in your code, where "NUM.ITEMS" is the number of items you're traversing.

CALL SB.DISP(9,"Processing Purchase Orders ":@AM:0:@AM:NUM.ITEMS)  ;* That is a zero, not the letter O, between the @AM's

Inside the loop, after you increment your looping variable (assuming a looping variable of L.LOOP), do the following:

CALL SB.DISP(9,"Processing Purchase Orders ":@AM:L.LOOP:@AM:NUM.ITEMS)

You can display the above on every iteration, or set up your code to do it on every 10th, 100th, whatever, if you want to cut down on the I/O.

When you run your process, you will get a nice solid color progress bar that creeps across the screen as progress is made, keeping your user informed (and less likely to exit the session)...

If anyone else has any tips or tricks that they have found useful, please share!  :)