Microsoft Small Basic

Program Listing: TZT429
' Sample program using the TITLE property.
' This one uses TextWindow multiple times to set the title property.
' A second version will use GraphicsWindow.
'
' Purpose: To illustrate the problem of using the TITLE property between the Desktop & Web IDE's.
'
' CAUTION:
' To allow this listing to run in the Web IDE, there are 18(!) lines that must be removed, or commented:
' - .CursorLeft: 36;
' - .CursorTop: 45; 51; 64; 70; 83; 89; 102; 108; 121; 128; 132;
' - .Title: 38; 53; 72; 91; 110; 129;

' values for sums
a = 6
b = 3

' line multiplier for each set of sums
c = 1

' divisor for flashing title highlighter
d = 25

' lines per task
l = 3

delay = 250

' what we are about to do
task = ""
' title highlighter
highlight = " "

' marker for the end of the highlighter string
TextWindow.Write(" <")
' reset the cursor to the left edge
TextWindow.CursorLeft = 0

TextWindow.Title = "Small Basic : TextWindow.Title : INITIAL"
For i = 1 To delay / d
If Math.Remainder(i,2) = 0 Then
TextWindow.ForegroundColor = "Gray"
Else
TextWindow.ForegroundColor = "DarkGray"
EndIf
TextWindow.CursorTop = 0
TextWindow.WriteLine(" |||||| ")
Program.Delay(delay)
EndFor
TextWindow.ForegroundColor = "White"

TextWindow.CursorTop = b * c
c = c + 1
TextWindow.Title = "Small Basic : TextWindow.Title : ADDITION"
TextWindow.ForegroundColor = "DarkGreen"
TextWindow.WriteLine("ADDITION")
TextWindow.ForegroundColor = "White"
TextWindow.WriteLine(a + " + " + b + " = " + (a + b) )
For i = 1 To delay / d
If Math.Remainder(i,2) = 0 Then
TextWindow.ForegroundColor = "Green"
Else
TextWindow.ForegroundColor = "DarkGreen"
EndIf
TextWindow.CursorTop = 0
TextWindow.WriteLine(" |||||||| ")
Program.Delay(delay)
EndFor
TextWindow.ForegroundColor = "White"

TextWindow.CursorTop = b * c
c = c + 1
TextWindow.Title = "Small Basic : TextWindow.Title : SUBTRACTION"
TextWindow.ForegroundColor = "DarkRed"
TextWindow.WriteLine("SUBTRACTION")
TextWindow.ForegroundColor = "White"
TextWindow.WriteLine(a + " - " + b + " = " + (a - b) )
For i = 1 To delay / d
If Math.Remainder(i,2) = 0 Then
TextWindow.ForegroundColor = "Red"
Else
TextWindow.ForegroundColor = "DarkRed"
EndIf
TextWindow.CursorTop = 0
TextWindow.WriteLine(" ||||||||||| ")
Program.Delay(delay)
EndFor
TextWindow.ForegroundColor = "White"

TextWindow.CursorTop = b * c
c = c + 1
TextWindow.Title = "Small Basic : TextWindow.Title : MULTIPLICATION"
TextWindow.ForegroundColor = "DarkYellow"
TextWindow.WriteLine("MULTIPLICATION")
TextWindow.ForegroundColor = "White"
TextWindow.WriteLine(a + " x " + b + " = " + (a * b) )
For i = 1 To delay / d
If Math.Remainder(i,2) = 0 Then
TextWindow.ForegroundColor = "Yellow"
Else
TextWindow.ForegroundColor = "DarkYellow"
EndIf
TextWindow.CursorTop = 0
TextWindow.WriteLine(" |||||||||||||")
Program.Delay(delay)
EndFor
TextWindow.ForegroundColor = "White"

TextWindow.CursorTop = b * c
c = c + 1
TextWindow.Title = "Small Basic : TextWindow.Title : DIVISION"
TextWindow.ForegroundColor = "DarkMagenta"
TextWindow.WriteLine("DIVISION")
TextWindow.ForegroundColor = "White"
TextWindow.WriteLine(a + " / " + b + " = " + (a / b) )
For i = 1 To delay / d
If Math.Remainder(i,2) = 0 Then
TextWindow.ForegroundColor = "Magenta"
Else
TextWindow.ForegroundColor = "DarkMagenta"
EndIf
TextWindow.CursorTop = 0
TextWindow.WriteLine(" ||||||| ")
Program.Delay(delay)
EndFor
TextWindow.ForegroundColor = "White"

' wait for user to press a key
TextWindow.CursorTop = 0
TextWindow.Title = "Small Basic : TextWindow.Title : FINISHED"
TextWindow.WriteLine(" ||||||| ")
c = c + 1
TextWindow.CursorTop = b * 6

' Obviously, this can be significantly changed to be made more efficient, but this is for illustrative purposes of the ".Title" property.