Microsoft Small Basic

Program Listing: HHS179-1
' Solution for Small Basic Know Issue:
' 29976 - Code in Event Handler Is Also Interrupted by Code in Main
' Version 0.3
' Program ID HHS179-1
' Usage:
' Hit space key to toggle solution. Hit enter for line feed.
CRLF = Text.GetCharacter(13) + Text.GetCharacter(10)
Not = "False=True;True=False;"
solution = "True"
GraphicsWindow.Title = "solution = " + solution
shpTxt = Shapes.AddText("")
Shapes.Move(shpTxt, 10, 10)
GraphicsWindow.KeyDown = OnKeyDown
While "True"
If out < in Then
out = out + 1
c = arry[out]
buf = buf + c + ","
Shapes.SetText(shpTxt, buf)
If c = "Space" Then
solution = Not[solution]
GraphicsWindow.Title = "solution = " + solution
ElseIf c = "Return" Then
buf = buf + CRLF
Shapes.SetText(shpTxt, buf)
EndIf
EndIf
EndWhile
Sub OnKeyDown
If solution Then
arry[in + 1] = GraphicsWindow.LastKey
in = in + 1
Else
in = in + 1
arry[in] = GraphicsWindow.LastKey
EndIf
EndSub