Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subtract two times
Message
 
À
07/01/2005 18:28:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7
Divers
Thread ID:
00971289
Message ID:
00975482
Vues:
14
This code works:


**************************************************
*-- Form: form1 (c:\eltest20\test.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 01/09/05 02:45:06 PM
*
DEFINE CLASS form1 AS form


DoCreate = .T.
Caption = "Form1"
Name = "Form1"


ADD OBJECT text1 AS textbox WITH ;
Value = (""), ;
Height = 23, ;
InputMask = "##:##:##", ;
Left = 11, ;
Top = 26, ;
Width = 100, ;
Name = "Text1"


ADD OBJECT text2 AS textbox WITH ;
Value = (""), ;
Height = 23, ;
InputMask = "##:##:##", ;
Left = 14, ;
Top = 67, ;
Width = 100, ;
Name = "Text2"


ADD OBJECT text3 AS textbox WITH ;
Value = (""), ;
Height = 23, ;
InputMask = "##:##:##", ;
Left = 10, ;
Top = 100, ;
Width = 100, ;
Name = "Text3"


ADD OBJECT text4 AS textbox WITH ;
Height = 23, ;
Left = 29, ;
Top = 150, ;
Width = 100, ;
Name = "Text4"


PROCEDURE addtime
LPARAMETERS nSecs, nSec2
LOCAL c_hours, c_min, nLocSec
IF TYPE("nSecs") # "C" .OR.;
TYPE("nSec2") # "C" .OR.;
TYPE("nSecs") # TYPE("nSec2")
RETURN ""
ENDIF
nLocSecs = VAL(LEFT(nSec2,2))*3600
nLocSecs = nLocSecs + VAL(SUBSTR(nSec2,4,2))*60+ VAL(SUBSTR(nSec2,7,2))
nLocSecs = nLocSecs + (VAL(LEFT(nSecs,2))*3600 + VAL(SUBSTR(nSecs,4,2))*60+ VAL(SUBSTR(nSecs,7,2)))

nSecs = ABS(nLocSecs)
c_hours = INT(nSecs/3600)
*IF c_hours > 24
* RETURN ""
*ENDIF
nSecs = nSecs - (c_hours*3600)
c_hours = IIF(c_hours<10,"0","")+ALLTRIM(STR(c_hours,15))
c_min = INT(nSecs/60)
nSecs = nSecs - (c_min*60)
c_min = IIF(c_min<10,"0","") + ALLTRIM(STR(c_min,15))
nSecs = IIF(nSecs<10,"0","") + ALLTRIM(STR(nSecs,10))
RETURN c_hours+":"+c_min+":"+nSecs
ENDPROC


PROCEDURE text1.InteractiveChange
thisform.Text4.Value = thisform.AddTime(thisform.AddTime(this.Value, thisform.Text2.Value), thisform.text3.Value)
ENDPROC


PROCEDURE text2.InteractiveChange
thisform.Text4.Value = thisform.AddTime(thisform.AddTime(this.Value, thisform.Text1.Value), thisform.text3.Value)
ENDPROC


PROCEDURE text3.InteractiveChange
thisform.Text4.Value = thisform.AddTime(thisform.AddTime(this.Value, thisform.Text2.Value), thisform.text1.Value)
ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
.Signature { margin-top: 12px; color: #666666; } .Signature a { color: #666666; }
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform