Microsoft Small Basic
Program Listing: SXD381-0
List Program
Initialise()
While 0=0
If dialogueOpen Then
ResumeDialogue()
Else
ResumeProgram()
EndIf
Program.Delay(100)
EndWhile
'MAIN SUBS
Sub ResumeProgram
If buttonClick = "Submit" Then
OpenDialogue()
buttonClick = ""
EndIf
EndSub
Sub ResumeDialogue
If buttonClick = "No" Then
CloseDialogue()
ElseIf buttonClick = "Yes" Then
CloseDialogue()
ElseIf buttonClick = "alert" Then
Sound.PlayBellRing()
EndIf
buttonClick = ""
EndSub
'2nd SUBROUTINES
Sub OpenDialogue
dialogueOpen = "True"
alert = Controls.AddButton("alert" 0 0)
Controls.SetSize(alert GraphicsWindow.Width GraphicsWindow.Height)
Shapes.SetOpacity(alert 20)
messageBox = Shapes.AddImage(img)
Shapes.Move(messageBox, (GraphicsWindow.Width - boxWidth) /2, (GraphicsWindow.Height - boxHeight) /2)
btnYes = Controls.AddButton("Yes", Shapes.GetLeft(messageBox)+50, Shapes.GetTop(messageBox)+130)
btnNo = Controls.AddButton("No", Shapes.GetLeft(messageBox)+130, Shapes.GetTop(messageBox)+130)
password = Controls.AddTextBox(Shapes.GetLeft(messageBox)+50, Shapes.GetTop(messageBox)+90)
Controls.SetTextBoxText(password "password")
EndSub
Sub CloseDialogue
dialogueOpen = "False"
Controls.Remove(alert)
Shapes.Remove(messageBox)
Controls.Remove(btnYes)
Controls.Remove(btnNo)
Controls.Remove(password)
EndSub
'SETUP
Sub Initialise
GraphicsWindow.DrawText(10 10 "Wait for download")
img = ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/689812")
boxWidth = ImageList.GetWidthOfImage(img)
boxHeight = ImageList.GetHeightOfImage(img)
If boxHeight > 0 Then
GraphicsWindow.Clear()
Else
GraphicsWindow.ShowMessage("Close and try again" "Error")
Program.End()
EndIf
GraphicsWindow.DrawText(10 10 "Sample Form")
txtBox = Controls.AddTextBox(10 50)
btnSubmit = Controls.AddButton("Submit" 10 85)
Controls.ButtonClicked = OnButtonClick
EndSub
Sub OnButtonClick
buttonClick = Controls.GetButtonCaption(Controls.LastClickedButton)
EndSub