Contents Previous Next Subchapters

Creating A New Table Window
Syntax addtable(captiongeometrycall back, ...
         
datacolumn labelsrow labelsstyle)
addtable(
captiongeometrycall back, ...
         
datacolumn labelsrow labelsstylefield width)
See Also gettable , setcells , delwin , adddialog , addeditor , gaddwin

Description
Creates a spread sheet style table window with the specified caption and geometry within the main O-Matrix window. If the value of geometry is novalue the new window is sized and positioned automatically by the system. The command specified by call back is executed when the user attempts to close the editor from the caption bar. O-Matrix does not automatically close the table in this case and the call back command should do so if that is appropriate. The integer, real, or double-precision matrix data contains the data that is initially in the table. The number of rows and columns in the table is set to the number of rows and columns in data. The character matrix column labels specifies the column labels for the table. The number of rows in column labels must equal the number of columns in data unless column labels is novalue , in which case no column labels are used. The character matrix row labels specifies the row labels for the table. The number of rows in row labels must equal the number of rows in data unless row labels is novalue , in which case no row labels are used. The character row vector style must have the value "normal" or "iconic". If style is "normal", the table is initially displayed in normal mode; if style is "iconic", the table is initially displayed as an icon but will have the specified geometry when normalized.

If data is a character matrix, the integer scalar field width must be used to specify the number of characters to place in each cell of the table. This number value must divide evenly (i.e., without a remainder) into the number of columns in data. If data is not a character matrix, the current format setting for the type of data is used to display the values in the table.

All entries are right justified in the corresponding cell of the table. The average character width and number of characters is used to determine the width of the columns of the table. If an entry or label does not fit in its cell, leading spaces can be used to make the cell wider.

Example
The following program creates a table with the values of x in the first column and the values of y in the second column. The table can be deleted using the control on the caption bar.

clear
x            = real(seq(10))
y            = 1. / x
caption      = "Example Table"
geometry     = [100, 100, 200, 400]
callBack     = "delwin(caption);"
data         = [x, y]
columnLabels = {"x", "y"}
rowLabels    = novalue
style        = "normal"
format real "f10.5"
addtable(caption, geometry, callBack, ...
         data, columnLabels, rowLabels, style)