Table initialization
The example initializes the table with four columns and 101 rows.
Let's have number of rows in the
Rows variable, in the
PmgWTable object in the
oTable variable placed in the panel.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var oTable = pMe;
var nRows = 101;
var nCols = 4;
var nMin = 20;
var nMax = 90;
oTable.Dim(nCols, nRows, 1, 1, 100, 20, 3, true);
// Setting the default table font:
oTable.Font.Name = "Arial";
oTable.Font.Size = 10;
oTable.Font.Bold = false;
oTable.Font.Italic = false;
// Setting the font of the table fixed part:
oTable.FixedFont.Name = "Courier";
oTable.FixedFont.Size = 12;
oTable.FixedFont.Bold = true;
oTable.FixedFont.Italic = true;
// Setting the table colors:
oTable.BackColor = "#ffffff";
// color setting by RGB String in the form "#RRGGBB"
oTable.ForeColor = "#000000";
oTable.FixedForeColor = "#000000";
oTable.FixedBackColor = "#00ff00";
var iRow, iCol;
// Text alignment of the table cells:
for (iCol = 0; iCol < nCols; iCol++)
{
oTable.SetCellTextAlign(-3, iCol, 1);
}
// Filling up the table header:
oTable.SetCellText(0, 1, "Temperature");
oTable.SetCellText(0, 2, "Minimum");
oTable.SetCellText(0, 3, "Maximum");
oTable.SetCellForeColor(-3, 2, "#0000d0");
// color setting by RGB String in the form "#RRGGBB"
oTable.SetCellForeColor(-3, 3, "#ff0000");
for (iRow = 1; iRow < nRows; iRow++)
{
oTable.SetCellText(iRow, 0, "Boiler" + iRow);
oTable.SetCellText(iRow, 1, Pm.Round(Pm.Random(0, 100), 1));
oTable.SetCellText(iRow, 2, nMin);
oTable.SetCellText(iRow, 3, nMax);
}
// Sets the possibility to edit table columns:
oTable.SetCellEditable(-3, 0, 0);
oTable.SetCellEditable(-3, 1, 2);
oTable.SetCellEditable(-3, 2, 2);
Dim oTable, nRows, nCols, nMin, nMax
Set oTable = pMe
nRows = 101
nCols = 4
nMin = 20
nMax = 90
oTable.Dim nCols, nRows, 1, 1, 100, 20, 3, true
' Setting the default table font:
oTable.Font.Name = "Arial"
oTable.Font.Size = 10
oTable.Font.Bold = false
oTable.Font.Italic = false
' Setting the font of the table fixed part:
oTable.FixedFont.Name = "Courier"
oTable.FixedFont.Size = 12
oTable.FixedFont.Bold = true
oTable.FixedFont.Italic = true
' Setting the table colors:
oTable.BackColor = "#ffffff"
' color setting by RGB String in the form "#RRGGBB"
oTable.ForeColor = "#000000"
oTable.FixedForeColor = "#000000"
oTable.FixedBackColor = "#00ff00"
Dim iRow, iCol
' Text alignment of the table cells:
For iCol = 0 To nCols - 1
oTable.SetCellTextAlign -3, iCol, 1
Next
' Filling up the table header:
oTable.SetCellText 0, 1, "Temperature"
oTable.SetCellText 0, 2, "Minimum"
oTable.SetCellText 0, 3, "Maximum"
oTable.SetCellForeColor -3, 2, "#0000d0"
' color setting by RGB String in the form "#RRGGBB"
oTable.SetCellForeColor -3, 3, "#ff0000"
For iRow = 1 To nRows - 1
oTable.SetCellText iRow, 0, "Boiler" & iRow
oTable.SetCellText iRow, 1, Pm.Round(Pm.Random(0, 100), 1)
oTable.SetCellText iRow, 2, nMin
oTable.SetCellText iRow, 3, nMax
Next
' Sets the possibility to edit table columns:
oTable.SetCellEditable -3, 0, 0
oTable.SetCellEditable -3, 1, 2
oTable.SetCellEditable -3, 2, 2