' ************************************************************************************
' * Traffic Light v0.1.sb 2014-09-07 *
' * Author: Luis Fonseca MS Small Basic v1.0 *
' ************************************************************************************
' * Description:
' * Simulate the trafic light process.
' * This project is designed for the "Traffic Light Challenge" on MS Small basic blog of
' * september 2014.
' *
' * Note: Need internet access for the background picture and the picture disponibility
' * is not garanted.
' ************************************************************************************
' *************************************************************************************
' *********************************** Main Program **********************************
Initiate()
ReStart:
SleepMode()
WorkMode()
Goto ReStart
' ************************************************************************************
' ********************************** Sub Programs ***********************************
' ==== ButtonProcess() ==============================================
Sub ButtonProcess
If Controls.GetButtonCaption(Controls.LastClickedButton) = "Quit" Then
Program.End()
EndIf
If (Controls.LastClickedButton = "Button2") Then
SleepMode = "false"
Controls.HideControl("Button2")
EndIf
If (Controls.LastClickedButton = "Button3") Then
WorkMode = "false"
Controls.HideControl("Button3")
EndIf
EndSub
' ============================================== ButtonProcess() ====
' ==== SleepMode() ================================================
' Wait in sleep Mode by flashing yellow when the trafic Light is out of service.
Sub SleepMode
SleepMode = "true"
Controls.ShowControl("Button2")
While SleepMode = "true"
Shapes.HideShape(MaskYellowLight)
Program.Delay(1000)
Shapes.ShowShape(MaskYellowLight)
Program.Delay(1000)
EndWhile