************************************************** *-- Form: form1 (c:\program files\microsoft visual foxpro 8\seconds.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 08/08/04 11:05:07 AM * DEFINE CLASS form1 AS form Height = 153 Width = 325 DoCreate = .T. AutoCenter = .T. Caption = "Form1" Name = "Form1" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; Caption = "Start Time:", ; Height = 17, ; Left = 15, ; Top = 18, ; Width = 61, ; Name = "Label1" ADD OBJECT txttime1 AS txttime WITH ; Height = 24, ; Left = 79, ; Top = 15, ; Width = 72, ; Name = "Txttime1" ADD OBJECT label2 AS label WITH ; AutoSize = .T., ; Caption = "Stop Time:", ; Height = 17, ; Left = 160, ; Top = 19, ; Width = 61, ; Name = "Label2" ADD OBJECT txttime2 AS txttime WITH ; Height = 24, ; Left = 224, ; Top = 16, ; Width = 72, ; Name = "Txttime2" ADD OBJECT label3 AS label WITH ; AutoSize = .T., ; Caption = "Difference:", ; Height = 17, ; Left = 38, ; Top = 57, ; Width = 61, ; Name = "Label3" ADD OBJECT lblelapsed AS label WITH ; AutoSize = .T., ; Caption = "", ; Height = 17, ; Left = 113, ; Top = 57, ; Width = 2, ; Name = "lblelapsed" ADD OBJECT command1 AS commandbutton WITH ; Top = 101, ; Left = 116, ; Height = 27, ; Width = 72, ; Caption = "Close", ; Name = "Command1" PROCEDURE secondsdifference LPARAMETERS tcStart, tcStop LOCAL ltstart, ltstop ltstart = CTOT(DTOC(DATE()) + SPACE(1) + tcStart) ltstop = CTOT(DTOC(DATE()) + SPACE(1) + tcStop) IF ltstart > ltstop THEN * Edit - This was orginally * ltstart = ltstart - (24 * (60 ^ 2)) - 1 ltstart = ltstart - (24 * (60 ^ 2)) ENDIF RETURN TRANSFORM(ltstop - ltstart) ENDPROC PROCEDURE txttime2.LostFocus ThisForm.lblelapsed.Caption =; ThisForm.Secondsdifference(ThisForm.txttime1.Value,; ThisForm.txttime2.Value) ENDPROC PROCEDURE command1.Click ThisForm.Release ENDPROC ENDDEFINE * *-- EndDefine: form1 ************************************************** ************************************************** *-- Class Library: c:\program files\microsoft visual foxpro 8\time.vcx ************************************************** ************************************************** *-- Class: txttime (c:\program files\microsoft visual foxpro 8\time.vcx) *-- ParentClass: textbox *-- BaseClass: textbox *-- Time Stamp: 08/08/04 09:52:00 AM * DEFINE CLASS txttime AS textbox Height = 23 InputMask = "##:##:##" Width = 100 Name = "txttime" PROCEDURE Valid LOCAL lnhours, lnminutes, lnseconds lnhours = VAL(LEFT(This.Value, 2)) lnminutes = VAL(SUBSTR(This.Value, 4, 2)) lnseconds = VAL(RIGHT(This.Value, 2)) RETURN BETWEEN(lnhours, 0, 23) AND; BETWEEN(lnminutes, 0, 59) AND; BETWEEN(lnseconds, 0, 59) ENDPROC ENDDEFINE * *-- EndDefine: txttime **************************************************