What is an Event

An event is something that happens independently of the normal flow of instructions in a program.

Often this is when something happens as a result of user interaction, such as when a key is pressed or the mouse is moved or clicked.

Within Small Basic an event method is shown in the intellisense with a lightning symbol shown below.

An event is initialised by defining which subroutine should be called when the event occurs. The assignment of an associated subroutine needs to be set only once. When the event occurs the associated subroutine will be called.

The following is a simple event that creates a pop-up when the mouse is clicked inside the GraphicsWindow.

GraphicsWindow.MouseDown = OnMouseDown

Sub OnMouseDown

GraphicsWindow.ShowMessage("Mouse was clicked","Information")

EndSub

===============

To read the other sections and get the latest version of this fantastic article, please see: