ox = createobject("progbar") ox.show() * Demonstrate that 100% shows correctly. ox.SetRange( 0, 10000) ox.SetPos( 10000) wait window "Progress bar shows 100%" * This will never reach 100% ox.Reset() lnReccount = 9999 && Or any number between 9901 and 9999 ox.SetRange( 0, lnReccount) ox.SetPos( 0) FOR lni = 1 to lnReccount if mod( lni, 100) = 0 ox.SetPos( lni) endif ENDFOR &&* lni = 1 to 10000 wait window "Progress bar shows 99%" ox = null release ox
>curEsc = set ('escape') >lcOnEsc=on('escape') >set escape on >llEsc= .f. >on escape llEsc = .t. >oProgBar = newobject('ProgBar','progbar.vcx') >*!* oProgBar.SetMessageFont('Arial', 8) >*!* oProgBar.SetTitleFont('Courier New', 8) >oProgBar.SetTitle('Calculating progress for:'+m.lcTitle) >oProgBar.SetMessage('File '+dbf('BldMstr')) >oProgBar.SetRange(0, m.lnReccount) >oProgBar.show() >*!* loTherm = newobject("thermometer", "wg","","Calculating Progress for:" + m.lcTitle, ; >*!* m.lnReccount) >*!* loTherm.show() >with thisform > .lockscreen=.t. > > scan > if m.llEsc and .NiceEsc() > exit > else > llEsc = .f. > endif > lnCount=m.lnCount+1 >*oProgBar.StepIt() >* -- Updating the percentage bar > if mod(m.lnCount,100) = 0 && or (m.lnCount>=m.lnReccount-10) >*loTherm.update(m.lnCount) > oProgBar.SetPos(m.lnCount) > set message to ' Record #'+transform(m.lnCount) + m.lcMsgTail > endif > if m.lnCount=m.lnReccount > oProgBar.UpdatePercent() > endif > do case > case m.tcMode = "Parse Situs" > .ProcParse(m.tcMode, m.llProgramExists) > > case m.tcMode = 'Parse Owner' > .ProcParse(m.tcMode, m.llProgramExists) > > case m.tcMode = 'ResOwner' > .ProcResOwner() > > case m.tcMode='Auto Situs' > .AutoAddrSitus() > > case m.tcMode='Auto Owner' > .AutoAddrOwner() > endcase > endscan > set message to 'Process is complete...' > oProgBar.release() > release oProgBar > .lockscreen=.f. >*!* loTherm.complete() >*!* if vartype(loTherm)='O' >*!* loTherm.release() >*!* endif >*!* release loTherm > wait window timeout 1 "" >* = Sleep(1000) && Wait 1 second > .lockscreen=.t. > set message to 'Process is complete... Wait while saving data..' > wait window nowait set('message',1) > select Bldmstr > set relation to && RMM 09/06/00 > if m.curEsc='ON' > set escape on && rmm 09/13/00 > else > set escape off > endif > on escape &lcOnEsc > if !m.llEsc > lnHCursor = LoadCursor(0, IDC_WAIT) >* Get the old cursor > lnOldCursor = SetCursor(m.lnHCursor) > if not .editmode && If already in Editmode then Just Save > .navstand.cmdEdit.click() && In Edit Mode > endif > .add() && Save changes > endif > if !empty(m.lcOrder) > set order to (m.lcOrder) > endif > if empty(.FilterStr) > goto m.lnRecno > else > go top > endif > .grdBldMstr.setfocus() > .lockscreen=.f. >* Restore old cursor > lnOldCursor = SetCursor(m.lnOldCursor) > wait clear >endwith >return !m.llEsc