How to Customize the PxPlus Progress Bar |
Starting with PxPlus 2025, the Progress Bar interface has been updated to give it a more modern look and feel. The appearance of the progress bar can also be further customized by using the five Global Variables, which have been provided to control the different aspects of the progress bar. These variables may be set in the START_UP program or in any other program prior to initializing a progress bar.
The examples below show you how to set these five global variables. Each example provides two screenshots showing the default appearance on the left and the customized appearance on the right.
Use these links to access a particular example:
How to Change the Progress Bar Color
How to Change the Background Color of the Progress Bar Window
How to Change the Font for the Text
How to Change the Color of the Percent Indicator Text
For the steps to set up the PxPlus progress bar, see How to Set Up the PxPlus Progress Bar.
The color of the progress bar meter can be controlled by setting the %_PROGBAR_BAR_CLR$ global variable.
Example:
%_progbar_bar_clr$="RGB:155 0 0" (Burgundy)
The background color of the progress bar window can be controlled by setting the %_PROGBAR_BACK_CLR$ global variable.
Example:
%_progbar_back_clr$="Dark Gray"
The font used for both the text (passed in as the text$ parameter) and the text on the Cancel button can be controlled by setting the %_PROGBAR_FONT$ global variable.
Example:
%_progbar_font$="Algerian"
When using the CALL "*progbar;Update_percent" method, the color of the percent indicator (passed in as the percent parameter) can be controlled by setting the %_PROGBAR_PERCENT_CLR$ global variable.
The color of the text (passed in as the text$ parameter) can be controlled by setting the %_PROGBAR_TEXT_CLR$ global variable.
The three steps below show you how to set up the three CALL routines that are required in a program to invoke the PxPlus progress bar.
These steps consist of initializing the progress bar, updating the progress bar, and then removing the progress bar window.
1. Initializing the Progress Bar
The first step is to place this CALL just before running the process or report in your program:
CALL "*progbar;Init", title$, barsize, [ , column, row, options$, ctlno ]
Where:
title$ |
(Required) A string that contains the title, which will display at the top of the progress bar window. Example: | ||||
barsize |
(Optional) A numeric value that contains the width of the bar to be created in columns. Minimum bar size is 15. Example: barsize=40 | ||||
column, row |
(Optional) Numeric values that contain the coordinates where the window will display on the screen. Example: column=150, row=10 (top right corner) | ||||
options$ |
(Optional) A string that contains the attribute options to be used in the creation of the dialogue window. Typical use would be to make the dialogue windows concurrent, thereby allowing the user to access controls on the current window. This would be the OPT=string$ settings for the dialogue window. See 'DIALOGUE' mnemonic for a list of supported options. Example: options$="i,-" | ||||
ctlno |
(Optional) A control value used to override the default control value of 4 that will be generated by the Cancel button. Users can cancel the process by doing one of the following:
When any of these methods are used, the following message displays: How to Remove the Cancel Button You may decide that you do not want the user to cancel the process because the program needs to finish properly; e.g. the program could be in a routine where files are being updated. You can remove the Cancel button so that the program finishes correctly with no interruptions.
|
2. Updating the Progress Bar
The second step is to update the progress bar. This CALL will go into the loop where the screen is loading or the records are being accumulated for the report being generated.
Two display types for the progress bar are available to choose from: Advance Bar or Show % Complete.
CALL "*progbar;Update" [, ERR=stmtref], text$ [ , image$ ]
CALL "*progbar;Update_percent" [, ERR=stmtref], text$, percent, [ , image$ ]
Where:
ERR=stmtref |
(Optional) An error transfer to a specific line number or statement label in which to transfer control. Example: | ||||||
text$ |
(Required) A string that contains the text to be displayed in the progress bar window. Example: Alternatively, you can create text with multiple lines by entering a carriage return/line feed ($0D0A$) after each line to improve readability. Example: | ||||||
image$ |
(Optional) A string that contains the pathname to an image that will be displayed in the top/left corner of the progress bar window. Example: To add a single image (e.g. an hourglass), the following syntax can be used: image$="C:\.myImage\hourglass48x48.png" How to Animate an Image (Optional) You can make an image appear animated by using the MOD( ) function and two images. The MOD( ) function returns the modulus/remainder from a division of the first expression by the second. Example:
| ||||||
percent |
(Required) The percent parameter is used only in the Show % Complete method as a numeric value that contains the percentage of the bar to show as complete. CALL "*progbar;Update_percent" [, ERR=stmtref], text$, percent, [ , image$ ] Example: How to Calculate the "percent" Parameter These steps show you how to calculate the percent parameter:
|
3. Closing the Progress Bar
The third step is to remove the progress bar window. When the accumulation is complete, you can add a method for the entry point to remove the progress bar window.
CALL "*progbar;Wrap_up"