gambas-source-code/app/examples/Control/LCDLabel/.src/FMain.class
Benoît Minisini 21e325b27a [EXAMPLES]
* NEW: Put the old examples in '/trunk/app/examples'.


git-svn-id: svn://localhost/gambas/trunk@6724 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-12-11 23:49:07 +00:00

52 lines
914 B
Text

' Gambas class file
Private $fTime As Float
Private $fAlarm As Float
Public Sub btnStart_Click()
Dim dAlarm As Date
If timClock.Enabled Then
timClock.Stop
Else
$fTime = Timer
dAlarm = timTime.Value
If Not dAlarm Then Return
$fAlarm = $fTime + Minute(dAlarm) * 60 + Second(dAlarm)
timClock.Start
timClock_Timer
Endif
End
Public Sub timClock_Timer()
Dim fDiff As Float
Dim dAlarm As Date
fDiff = $fAlarm - Timer
If fDiff <= 0 Then
dAlarm = timTime.Value
$fAlarm += Minute(dAlarm) * 60 + Second(dAlarm)
fDiff = $fAlarm - Timer
Music.Play
Endif
lblAlarm.Text = Format(Int(fDiff / 60), "00") & ":" & Format(Int(fDiff - Int(fDiff / 60) * 60), "00") & ":" & Format(Int(Frac(fDiff) * 100), "00")
End
Public Sub Form_Arrange()
lblAlarm.Padding = lblAlarm.Width / 16
End
Public Sub Form_Open()
Music.Load("alarm.ogg")
End