Microsoft Small Basic

Program Listing: VNR260
'learning aid revised by Ezra94
gw = 400
gh = 400
GraphicsWindow.Height = gh
GraphicsWindow.Width = gw
GraphicsWindow.Left = (Desktop.Width-gw)/2
GraphicsWindow.Top = (Desktop.Height-gh)/4

createGUI()
Controls.ButtonClicked = onButtonClick

Sub createGUI
bw = gw/2
bh = gh/10
bx = (gw - bw)/2
by = (gh - bh)/2

mainTxtBox = Controls.AddTextBox(bx,by)
Controls.SetSize(mainTxtBox,bw,bh)

mainButton = Controls.AddButton("Enter",bx,by+bh)
Controls.SetSize(mainButton,bw,bh)

clearButton = Controls.AddButton("Clear",bx,by+bh*2)
Controls.SetSize(clearButton,bw,bh)

For i = 0 To 9
digits[i] = i
EndFor
EndSub

Sub onButtonClick
input = Controls.GetTextBoxText(mainTxtBox)
If (Controls.GetButtonCaption(Controls.LastClickedButton) = "Enter") Then
keyWordL = Text.GetLength(input)
For i = 1 To keyWordL
nums[i] = Text.GetSubText(input,i,1) 'breaks down input into seperate variables
If Text.IsSubText("0123456789",nums[i]) Then
GraphicsWindow.DrawText(bx,by-bh*2,nums[i])
bx = bx + 8
EndIf
EndFor
ElseIf (Controls.GetButtonCaption(Controls.LastClickedButton) = "Clear") Then
GraphicsWindow.Clear()
createGUI()
EndIf
EndSub