SOB – a – Introduction

SOB is an abbreviation of Screen OBjects. It is the name used in this executable for GUI components that can be used to create a user defined GUI.

The GUI for this executable was itself created by using SOBs.


There is basically only one command for creating and managing user defined Screen OBjects, the sob command.

The sob command is heavily overloaded. That is to say that the command  sob (a function)  can have a variety of parameters, where the meaning of parameter (n+1) is often dependent on an earlier e.g. parameter (n).

Inherent in the SOB concept is that of a container.

A container is a set of positioning and sizing rules that is applied to the SOBs that are placed inside that container.

All SOBs (except for the top SOB) belong to a container SOB.

The first  SOB is always a Window and belongs to the desktop , and has the rules:

  • Child SOBs define their own size
  • Child SOBS are placed one under the other, newest at the bottom, with no overlaps.

So most GUIs start-off with something like:

' create a hello world type application, in a standard window structure
newscript    ' has an internal call to SOB("new")
' -----------------------------------------------------
' create a new window without a parent (hence the first parameter is 0 = no parent )
' A window is a container, which positions its children one under the other in a
' simple column. A window container does not impose any dimensioning rules on its children SOBs-
'
dim myWindow = sob (0, "add","window","Hello World")


Script explanation:

The command SOB("new") will delete all existing SOB, so it is a bit like  newscript , note that newscript actual calls  SOB("new"

Each SOB has a numerical identity. When we create a SOB we receive back its identity, when we act upon that SOB (e.g. change its text) we do so by reference to the SOB identity. The top level SOB is always identity = 0. Think of SOB o as being the desktop.

When we define a SOB (except the top level SOB) we need to identify the parent SOB of the new object. So the line:

dim myWindow = sob (0, "add","window","Hello World")

means:

  • Add a “Window” to the SOB 0 .
  • Set the default text for the new SOB to be “Hello World“.  For a Window SOB the default text is its title. (For a button SOB the default text is the text displayed in the button.)
  • Save the identity of the window SOB in the variable  myWindow

You can create more than one window SOB if you want!


This is what the above script generates:

Not very exciting. But we can build on this: add menus, event handles, add other SOBs and and and make wonderful music.

Here is a screenshot of the simple and naive GUI for the Midi demo.

There are some SOB demos embedded in the executable, and can be found at the following location under the help menu.