TProgressWheel
Source: source/classes/metrcirc.prg
Inherits from: TControl
TProgressWheel is a GDI+-based circular/ring progress indicator that displays percentage-complete text in the center. It supports gradient fill colors for both the done and remaining arc segments, an adjustable inner diameter, and an indeterminate spinning mode suitable for unknown-duration operations. Color properties accept numeric RGB values, gradient arrays, image file paths, or TBrush objects.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
nMin, nMax | Numeric | Range minimum and maximum values |
nPos | Numeric | Current position within the range |
nStep | Numeric | Step increment value |
cPrompt | Character | Optional custom text or code block displayed in center |
lPercentage | Logical | Show percentage text in center of wheel |
nStartAngle | Numeric | Starting angle in degrees (default -90, 12 o'clock) |
nInnerDia | Numeric | Inner diameter ratio (0.0-1.0, default 0.75) |
lIndefinite | Logical | Enable indeterminate spinning animation |
nColorText | Numeric | Text color for percentage or prompt display |
nColorInner | Numeric/Array | Inner circle color (numeric or gradient) |
nColorRemain | Varies | Remaining arc brush: numeric, gradient, image path, or TBrush |
nColorDoneMin | Varies | Completed arc brush: numeric, gradient, image path, or TBrush |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, oWnd, nPos, nW, nH, lPixel, lDesign, oFont, cPrompt, lNoPct, nClrInner, nClrRemain, nClrDoneMin, nClrText, nMin, nMax, nInnerDia ) | Create a new TProgressWheel control |
SetPos( nVal ) | Set the current position and refresh the display |
GetPos() | Return the current position value |
SetRange( nMin, nMax ) | Change the range minimum and maximum |
SetInner( nSize ) | Adjust the inner diameter ratio |
Indefinite( lOn ) | Enable or disable indeterminate spinning mode |
Default() | Apply default size and position settings |
Example: Ring Progress at 35%
#include "FiveWin.ch"
function Main()
local oWnd, oWheel
DEFINE WINDOW oWnd TITLE "Progress Wheel" SIZE 300, 300
oWheel := TProgressWheel():New( 20, 20, oWnd, 35,, 100, 100,;
.T.,,, .F., CLR_HGRAY,;
CLR_HRED, CLR_HGREEN, CLR_WHITE,;
0, 100, 0.60 )
oWheel:lPercentage := .T.
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- TProgressWheel uses GDI+ for all rendering. The FWH library links GDI+ support by default in recent builds.
- Color properties
nColorRemainandnColorDoneMinaccept numeric RGB, two-element gradient arrays{ nClr1, nClr2 }, image file paths for texture brushes, or TBrush objects. - In indeterminate mode (
Indefinite( .T. )), an internal timer drives continuous rotation of two colored arcs, suitable for operations of unknown duration. - The inner diameter controls ring thickness. Values near 0 produce a solid disk; values near 1 produce a thin ring outline.