Code : Tout sélectionner
; PB 4.30 // By Ar-S 2008
Enumeration
#BT_HtM
#AFF
#BT_MtoH
EndEnumeration
Global M,H,H$,M$,newH,ResteMin
Procedure HtoM(numGadgetHeure,NumgadgetMin)
H$=GetGadgetText(numGadgetHeure)
H=60*Val(H$)
M$=GetGadgetText(NumgadgetMin)
M=Val(M$)+H
;ProcedureReturn M
EndProcedure
Procedure MtoH(numGadgetHeure,NumgadgetMin)
H$=GetGadgetText(numGadgetHeure)
If H$=""
H$="0"
EndIf
M$=GetGadgetText(NumgadgetMin)
H=Val(GetGadgetText(numGadgetHeure))
M=Val(GetGadgetText(NumgadgetMin))
ResteMin=M % 60
newH=M/60+H
EndProcedure
Procedure OpenWindow_Window_0()
If OpenWindow(0, 450, 200, 312, 135, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
StringGadget(1, 5, 5, 130, 25, "Heures", #PB_String_Numeric)
StringGadget(2, 150, 5, 160, 25, "Min", #PB_String_Numeric)
ButtonGadget(3, 0, 35, 310, 25, "HourTo Min")
EditorGadget(5, 1, 100, 310, 30, #PB_Editor_ReadOnly)
ButtonGadget(4, 0, 70, 310, 25, "Min to hour")
EndIf
EndProcedure
OpenWindow_Window_0()
;{- Event loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 3
HtoM(1,2)
SetGadgetText(5," Conversion en minute(s) : "+Str(M)+" Minutes")
Case 4
MtoH(1,2)
SetGadgetText(5,"Conversion en heure(s) : "+Str(newH)+" heures et "+Str(ResteMin)+" minutes.")
EndSelect
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
End
EndSelect
EndSelect
ForEver
;
;}