Table Object
Easily create tables as part of JavaScript GUI's.

This script contains code for a custom Table object. It includes a note at the point were users could add their own settings for colours/styles.
Users can create tables by invoking the constructor:
new Table(win,left,top,width,height,rows,cols)
- win = window
- left = left hand position
- top = top position
- width = width of table
- height = height of table
- rows = number of rows
- cols = number of cols
row and cols can be:
- an array of integers describing row and col widths respectively – in which case rows.length would be the number of rows and the height is replaced by the total of the row array items.
OR
- row and col can be integers describing the number of each – resulting in even column/row sizing.
The table object created has the following properties and methods:
Properties:
.cells (2D array) = the widgets for the table
.rows = number of rows
.cols = number of columns
.hidden (boolean) = whether the table is currently hidden (true = hidden)
.width = table width
.height = table height – note width and height might not exactly equal the inputs requested
– this is due to equal row heights needing to be integer vals (e.g a height of 5 and 2 rows ends up being a height of 4 (2.5 is not a valid row height))
.top | .bottom | .left | .right = positions of table extremes
Methods:
Hide() = Hide the table
Show() = Show the table
SetProp(prop, prop_val) = Set property ‘prop’ to ‘prop_val’ for entire table e.g. t.SetProp(background, Colour.RED); //set background colour to red
SetRowProp(prop, prop_val, row) = As SetProp but only for the specified row (index from 0)
SetColProp(prop, prop_val, col) = As SetProp but only for the specified column (index from 0)