|
Previous Top Next |
The Progress Class is designed to handle progress bars. In its simplest form it can be used with 3 statements, Init, Update and Kill. Before a loop the Init is called to initialize what progress control to use and how many records will be processed. Update is called during the loop to update the progress bar and after the loop Kill is called to hide the progress bar.
ITProgressClass Class(ITUtilityClass),TYPE,Module('ITProgressClass.clw'),Link('ITProgressClass',_ITUtilLinkMode_),DLL(_ITUtilDllMode_)
CurrentValue Long,Private
DisplayControls &ITDisplayQueue
HideUnhide Byte
Initialized Byte
PercentValue Byte,Private
ProgressControl Long,Private
TotalValue Long,Private
AddDisplayControl Procedure(LONG pControLToDisplay,Byte pUpdateOnShow=1)
AddToCurrentValue Procedure(Long pValueToAdd),LONG,PROC ! Adds value and returns new current value
Calculate Procedure ! Calculates percent
GetCurrentPercent Procedure(),BYTE ! Returns 0 - 100
GetCurrentValue Procedure(),LONG ! Returns CurrentValue
GetProgressControl Procedure(),LONG ! Returns ProgressControl
GetTotalValue Procedure(),LONG ! Returns TotalValue
HideControls Procedure(BYTE pHide) ! Hide/unhide display controls
Init Procedure(LONG pProgressControl, Long pTotalValue, Byte pHideUnhide=1, Byte pCanBeZeroOrOne=True)
Kill Procedure
SetCurrentValue Procedure(Long pCurrentValue)
SetTotalValue Procedure(LONG pTotalValue)
ShowProgress Procedure
ShowUpdateProgress Procedure(Long pValueToAdd) ! Update progressbar after adding pValueToAdd to the value.
Update Procedure ! Calls ShowUpdateProgress(1)
End
Example:
ITP ITProgressClass
I Long
Q Queue
F1 String(100)
End
Code
Do FillQueue
ITP.Init(?Progress1,Records(Q))
Loop I = 1 To Records(Q)
Get(Q,I)
ITP.Update
End
ITP.Kill