Program.Delay(delay1)
If i < 10 Then
'Clear contents of i and Rand1 until i=10
GraphicsWindow.BrushColor = "LightBlue"
GraphicsWindow.FillRectangle(gw+115,240,70,20)
GraphicsWindow.FillRectangle(gw+115,340,70,20)
EndIf
EndFor
EndSub
Sub OnMouseDown 'THIS AN EVENT HANDLER. USSUALLY JUST SET A FLAG e.g. mouseDown = "true"
'the flag will be read by the Main Loop
xm = GraphicsWindow.MouseX
ym = GraphicsWindow.MouseY
'Respin button
If (xm > gw+15 And xm < gw+85) Then
If (ym > 580 And ym < 595) Then
mouseDown = "True"
'Spinrolls() 'Calling this in the Main loop aka UI thread
EndIf
EndIf
'Stop button
If (xm > gw+115 And xm < gw+185) Then
If (ym > 580 And ym < 595) Then
iend = "True"
EndIf
If (iend) Then
Program.End()
EndIf
EndIf