Here is a simple Small Basic program that uses two buttons. When a button is pressed, a window message pops up naming the button that was pressed.
GraphicsWindow.Show()
'Add the button labeled Exit
ExitButton = Controls.AddButton("Exit",20,50)
'Add the button labeled Hello
HelloButton = Controls.AddButton("Hello",20,20)
'When a button is clicked, call the ButtonsBeenClicked subroutine
Controls.ButtonClicked=ButtonsBeenClicked
Sub ButtonsBeenClicked
'If the Hello button was clicked, display the message Hello Button Presssed
If controls.LastClickedButton = HelloButton then
GraphicsWindow.ShowMessage("Hello Button Pressed","Button Message")
'Else if the Exit button was clicked, display the message Exit Button Pressed
ElseIf controls.LastClickedButton = ExitButton then
GraphicsWindow.ShowMessage("Exit Button Pressed","Button Message")
EndIf
EndSub
GraphicsWindow.Show()
'Add the button labeled Exit
ExitButton = Controls.AddButton("Exit",20,50)
'Add the button labeled Hello
HelloButton = Controls.AddButton("Hello",20,20)
'When a button is clicked, call the ButtonsBeenClicked subroutine
Controls.ButtonClicked=ButtonsBeenClicked
Sub ButtonsBeenClicked
'If the Hello button was clicked, display the message Hello Button Presssed
If controls.LastClickedButton = HelloButton then
GraphicsWindow.ShowMessage("Hello Button Pressed","Button Message")
'Else if the Exit button was clicked, display the message Exit Button Pressed
ElseIf controls.LastClickedButton = ExitButton then
GraphicsWindow.ShowMessage("Exit Button Pressed","Button Message")
EndIf
EndSub