Event Basics - Small Basic Featured Article

Today we're going to look at an incredibly helpful TechNet Wiki article from litdev:

Small Basic: Event Basics

  

LitDev takes us through a very thorough look at Events in Small Basic.

The article is made up of four sections:

 

The Other Languages section currently features the French version of this article, translated by Wiki Ninja, Yan Grenier:

Small Basic - Les Bases : Les Evènements (fr-FR)

 

Here's the intro section:

 

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:

Small Basic: Event Basics

 

Thanks again to litdev for this great article and to Yan Grenier for translating it into French!

  

Small and Basically yours,

   - Ninja Ed