Sub Globals
mode = ""
End Sub
Sub App_Start
Form1.Show
obj.New1(False)
obj.FromControl("form1")
eventActivated.New1(obj.Value, "Activated")
eventDeactivated.New1(obj.Value, "Deactivate")
obj.FromControl("form2")
eventActivated2.New1(obj.Value, "Activated")
eventDeactivated2.New1(obj.Value, "Deactivate")
AddEvent("eventActivated", NewEvent, "FormActivate")
AddEvent("eventActivated2", NewEvent, "FormActivate")
AddEvent("eventDeactivated", NewEvent, "FormDeactivate")
AddEvent("eventDeactivated2", NewEvent, "FormDeactivate")
AddTimer("tmrA")
tmrA.Interval = 10
End Sub
Sub AppActivate
form1.Text = "activated: " & TimeS
End Sub
Sub AppDeactivate
form1.Color = Rgb(Rnd(0,255), Rnd(0, 255), Rnd(0, 255))
End Sub
Sub FormActivate
If mode = "deactivate" Then 'shifting between forms
tmrA.Enabled = False
Else
mode = "activate"
tmrA.Enabled = True
End If
End Sub
Sub FormDeactivate
If mode = "activate" Then 'shifting between forms
tmrA.Enabled = False
Else
mode = "deactivate"
tmrA.Enabled = True
End If
End Sub
Sub tmrA_Tick
tmrA.Enabled = False
If mode = "activate" Then AppActivate Else AppDeactivate
mode = ""
End Sub
Sub Button1_Click
form2.Show
End Sub