Introduction

Series of know issues articles are showing known issue itself about Small Basic and it's workaround. In this article, local means Small Basic IDE environment and remote means internet browser environment with Silverlight add-in.

Phenomenon

Calling following operations in an event handler such like on key down causes the browser hang up in remote.

  • Turtle.Move() operation
  • Turtle.MoveTo() operation
  • Turtle.Turn() operation
  • Turtle.TurnLeft() operation
  • Turtle.TurnRight() operation

Following is a sample error message in the bottom of the Internet Explorer.

Workaround

So in remote, operations above should be outside of event handlers.  Following code is the sample how to avoid this issue.

Before

Turtle.Show()
GraphicsWindow.KeyDown = OnKeyDown
Sub OnKeyDown
  If GraphicsWindow.LastKey = "R" Then
    Turtle.TurnRight()
  EndIf
EndSub

After

Turtle.Show()
GraphicsWindow.KeyDown = OnKeyDown
While "True"
  If keyDown Then
    If key = "R" Then
      Turtle.TurnRight()
    EndIf
    keyDown = "False"
  Else
    Program.Delay(200)  ' for reducing server load
  EndIf
EndWhile
Sub OnKeyDown
  key = GraphicsWindow.LastKey
  keyDown = "True"
EndSub

Sample Programs

  • Turtle Operations on Key Down RQS498 - This program reproduces this issue by typing one of M, 2, T, L or R keys.
  • Turtle Dodger 0.5b QZN342-3 - This game has workaround of this issue.  But version 0.1a QZN342 doesn't.

See Also