SOB – c – Container – Panels

A panel is one of my favourite SOBs. It creates an area on the display that is split in to two parts by a moveable divider.

The basic GUI of this executable consists of a panel, where one of the panel areas host another panel.


The following script mimics the basic structure of this executable.

newscript
dim myWindow = sob (0, "add","window","Hello World")
function ClickMyWindow ( sobid )
sob ( myWindow, "delete")
quit
End function
sob ( myWindow , "ON" , "CLICK" , "ClickMyWindow" )
dim myMenuBar = sob (myWindow , "add" , "menu" , "bar" )
dim myMenuFile = sob (myMenuBar , "add" , "menu" , "Horizontal" , "File" )
dim myFileExit = sob ( myMenuFile , "add" , "menu" , "Vertical" , "Exit" )
sob ( myFileExit , "ON" , "CLICK" , "ClickMyWindow")

' Place a container inside myWindow (containers can be nested).
' The container PANEL.H
' has two childrem SOBs, called PANELS, each a type of COLUMN container.
' The children are spearated by a movable horizontal bar.
' The children SOBs identities are the PANEL.H SOBs id +1, +2
'
dim top2Bottom = sob( myWindow , "add", "container", "panel.h" , " ", 20 )
dim topP = top2Bottom +1
dim BottomP = top2Bottom +2

' Place a container inside the PANEL BottomP
' The container, a PANEL.V
' has two childrem SOBs called PANELS, each is a type of COLUMN container.
' The children are separated by a movable vertical bar.
' The children SOBs identities are the PANEL.H SOBs id +1, +2
'
dim left2right = sob( topP , "add", "container", "panel.v" , " ", 5 )
dim LeftP = left2right + 1
dim RightP = left2right + 2

When you create a PANEL, the SOB commands returns the identity of the Panel, the identities of its two areas are the Panel identity +1 , and the Panel identity + 2.

The resulting GUI is shown below:

The red and blue arrows show where these 2 panel objects can be resized.

So the following is perfectly possible:

Each of the two areas of a panel act as simple COLUMN containers.


Functional specifications for panel container related SOB commands:
Add – Container

SOB ( _
<Parent: number expression> , _
"ADD" , _
"CONTAINER" , _
"container type" , _
<WIDTH: string expression> , _
<ROWS: integer expression> _
)

Where container type (enclosed in a pair of " ) must be replaced by one of the following (case insensitive):

  • panel.h
  • panel.v

<WIDTH: string expression> is a string of text (not displayed) that defines the minimum width of the panel in terms of text characters.

<ROWS: integer expression> is an integer that defines the minimum height of the panel in terms of text rows.