5e92876cad
* NEW: LCDLabel now uses gb.sdl2.audio. [GB.FORM] * BUG: The ToolPanel buttons now takes Style.FrameWidth into account. [GB.GTK] * BUG: Remove a debugging message. [GB.QT4] * BUG: Do not delete open windows later when the event loop is finished. This is not supported by QT. git-svn-id: svn://localhost/gambas/trunk@6797 867c0c6c-44f3-4631-809d-bfa615b0a4ec
53 lines
940 B
Text
53 lines
940 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()
|
|
|
|
Sound.Frequency = 48000
|
|
Music.Load("alarm.ogg")
|
|
|
|
End
|