SOB – Container – Stretching

I must admit that this seems a bit weird, but it has proved to be extremely useful.

Any container can be instructed to make its last child as big a possible.


Consider the following script. Note how the stretch line is commented out, and that I have changed the sequence to Label/Button/Listview  from the usual Label/ListView/Button (purely for visual impact).

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")

dim myContainer = sob ( myWindow , "add" , "CONTAINER" ,"COLUMN" , 3)
' sob ( myContainer, "SET", "STRETCH",1)

sob ( myContainer, "add" ,"label" , "Label" )
sob ( myContainer, "add" , "button" , "Push" , "Push button" )
sob ( myContainer, "add" , "LISTVIEW"," ", 5,0x00800008 )

The resulting GUI is:

Now change the commented out line (shown above in green), remove the leading ', and run the script.

The GUI has quite a different appearance.:

It took me a while to get used to stretching, but now I find stretching (and panels) virtually indispensable.

Note how if you use the mouse and resize the GUI, that the last child (ListView) changes size as well.


Functional specifications for stretching related SOB commands:
Set – Stretch

SOB ( _
<Parent: number expression> , _
"SET" , _
"STRETCH" , _
)