Desktop Progress Bar
From Xojo Documentation
Progress Bars are designed to indicate that some function of your application is progressing (hence the name) towards its goal or to show capacity. A Progress Bar can only be displayed horizontally.
Properties
- Specifies the maximum value of the Progress Bar.
- The current value of the Progress Bar.
Indeterminate Progress Bar
The Indeterminate Progress Bar is a Progress Bar with its maximum property set to 0. On Windows and Linux, an indeterminate progress bar takes the form of a single block that moves back and forth. On Mac, an interdeterminate progress bar pulses slightly. When this progress bar is visible it always shows its indeterminate state. To hide it, set its Visible property to False.
Usage
To update a ProgressBar you will typically use a Timer and a Thread. The Timer can periodically check the status of a long-running process in a Thread and then update the state of the ProgressBar. If the long-running process is not in a Thread, then it will not allow the user interface to update and thus not allow the Progress Bar to get updated.
This code in a Timer's Action event handler updates the value of the ProgressBar until it reaches the maximum:
// The Timer uses the value in the property to update the Progress Bar
CopyProgressBar.Value = CopiedItems
Example Projects
These examples demonstrate how to use a Progress Bar:
- Examples/Desktop/Controls/ProgressBar
- Examples/Desktop/UpdatingUIFromThread/UIThreadingWithTask
- Examples/Desktop/UpdatingUIFromThread/UIThreadingWithTimer
See Also
ProgressBar, Timer, Thread classes; UserGuide:Desktop UI, UserGuide:Desktop Progress Wheel topics