************************************************** *-- Class: stopw *-- ParentClass: container *-- BaseClass: container * DEFINE CLASS stopw AS container Width = 197 Height = 166 BackColor = RGB(128,0,255) Name = "stopw" *-- pi()*2 twopee = .F. ADD OBJECT timer1 AS timer WITH ; Top = 12, ; Left = 12, ; Height = 23, ; Width = 23, ; Interval = 1000, ; Name = "Timer1" ADD OBJECT lineh AS line WITH ; BorderWidth = 4, ; Height = 60, ; Left = 96, ; Top = 24, ; Width = 0, ; BorderColor = RGB(0,255,0), ; Name = "LineH" ADD OBJECT linem AS line WITH ; BorderWidth = 3, ; Height = 60, ; Left = 96, ; Top = 24, ; Width = 0, ; BorderColor = RGB(255,255,255), ; Name = "LineM" ADD OBJECT lines AS line WITH ; BorderWidth = 2, ; Height = 60, ; Left = 96, ; Top = 24, ; Width = 0, ; BorderColor = RGB(255,255,0), ; Name = "LineS" *-- move the line to its proper position PROCEDURE putline Lpara x,y, oLine nTop=min(y, 84) nLeft=min(x, 96) nHeight=abs(y-84) nWidth=abs(x-96) if (y>84)#(x>96) cSlant="/" else cSlant="\" endif with oLine .top=nTop .Left=nLeft .Width=nWidth .height=nHeight .LineSlant=cSlant endwith ENDPROC PROCEDURE drawtime LPara lFromInit cTime=time() cHour=wordnum(cTime,1,":") cMinute=wordnum(cTime,2,":") cSecond=wordnum(cTime,3,":") nHour=val(cHour)%12 nMinute=val(cMinute) nSecond=val(cSecond) This.CalcAndDraw(nSecond/60,60,This.LineS) if nSecond=0 or lFromInit This.CalcAndDraw(nMinute/60,55,This.LineM) * if nMinute=0 or lFromInit This.CalcAndDraw((nHour+nMinute/60)/12,50,This.LineH) * endif endif ENDPROC PROCEDURE calcanddraw lPara nPartOf, nLineLen, oLine nx=96+cos(this.TwoPee*(-.25+nPartOf))*nLineLen ny=84+sin(this.TwoPee*(-.25+nPartOf))*nLineLen this.PutLine(nx, ny, oLine) ENDPROC PROCEDURE Init this.setall("visible",.t.,"line") this.TwoPee=2*pi() This.DrawTime(.t.) ENDPROC PROCEDURE timer1.Timer This.Parent.DrawTime ENDPROC ENDDEFINE * *-- EndDefine: stopw **************************************************