*============Progress.cc progress bar..... * * Traker International - www.autotraker.com * * Based on a control by Alan Katz * and Enhancements by Garry Christensen * and gwGradient.cc by Gary White * this needs gwGradient.cc * Usage: * form.GradBar1.setup(100) * To increment use: * form.GradBar1.update() * with no parameters to just increment by one or * form.GradBar1.update(10) * to increment by 10 * form.GradBar1.Gradient = false * will turn off the gradient, it then uses * color1 for both colors. * you can pass the colors to it as RBG * strings, same as the output of getcolor() * form.GradBar1.color1 = '255,0,0' * form.GradBar1.color2 = '0,0,255' * see TIProgress.cc for text features ************************************* Class GradBar(f,n) of container(f,n) Custom this.height = 1.06 this.width = 20 this.nMax = 0 this.nInterval = 1 this.borderStyle = 7 // Client this.visible = true this.Gradient = true this.ParentClassName = "CONTAINER" this.color1 = '255,0,0' this.color2 = '0,255,0' set procedure to :ti:gwGradient.cc additive *************************************************************** function RePaintObject(hWND) *************************************************************** if Type("UpdateWindow") # "FP" extern CLOGICAL UpdateWindow(CHANDLE) User32 endIf UpdateWindow(hWND) return *************************************************************** function convertColor(clr) *************************************************************** local n n = val(clr) clr = substr(clr, at(',', clr) + 1) n += bitlshift(val(clr), 8) clr = substr(clr, at(',', clr) + 1) n += bitlshift(val(clr), 16) return n *************************************************************** function Setup(nMaximum) *************************************************************** this.nMax = nMaximum this.nTest = 0 this.nJump = -1 this.nInterval = 1 if type('this.parent.GradDISP1') # 'O' color1 = this.color1 color2 = this.color2 this.parent.GradDISP1 = new GWGRADIENT(this.parent) with (this.parent.GradDISP1) visible = this.visible height = this.height-.12 width = this.width-.35 left = this.left+.17 top = this.top+.06 Pageno = this.Pageno color1 = this.convertColor("&color1.") color2 = this.convertColor("&color2.") fadeStyle = 2 BorderStyle = this.BorderStyle endwith GradDISP1 = this.parent.GradDISP1 this.parent.GradDISP2 = new RECTANGLE(this.parent) with (this.parent.GradDISP2) ColorNormal = this.ColorNormal visible = this.visible height = GradDISP1.height-.12 width = GradDISP1.width-.17 left = GradDISP1.left+.17 top = GradDISP1.top+.06 Pageno = this.Pageno BorderStyle = 3 endwith endif if this.Gradient color2 = this.color2 else color2 = this.color1 endif this.parent.GradDISP1.color2 = this.convertColor("&color2.") this.update() return *************************************************************** function UPDATE *************************************************************** Parameters increment local GradDISP1,GradDISP2 GradDISP2 = this.parent.GradDISP2 GradDISP1 = this.parent.GradDISP1 if type("increment") = "N" This.nJump = increment else This.nJump ++ endif this.nCurrNum = this.nJump if this.nCurrNum = 0 GradDISP2.Width = GradDISP1.width - .35 GradDISP2.left = GradDISP1.left + .17 this.nJump = 0 return endif if INT(this.nCurrNum/this.nInterval) > this.nTest this.nTest = INT(this.nCurrNum/this.nInterval) Local nDecimalDone,nWidth nDecimalDone = round(this.nCurrNum/this.nMax,2) nWidth = GradDISP1.width-.35 if GradDISP1.width - (nDecimalDone*nWidth) <= .17 GradDISP2.width = .17 GradDISP2.left = GradDISP1.left + GradDISP1.width - .17 else GradDISP2.width = GradDISP1.width - (nDecimalDone*nWidth) GradDISP2.left = GradDISP1.left + (nDecimalDone*nWidth) endif endif this.RePaintObject(GradDISP1.hWND) return *************************************************************** Function Release *************************************************************** IF type('This.Parent.GradDISP1') = 'O' release object This.Parent.GradDISP1 release object This.Parent.GradDISP2 endif return endclass