Table inicialization
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 i;
var oTable = pMe;
var nRows = 101;
var nCols = 4;
var Minimum = 20;
var Maximum = 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";
// Text alignment of the table cells:
for (i = 0; i < nCols; i++)
{
oTable.SetCellTextAlign(-3, i, 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 (i = 1; i < nRows; i++)
{
oTable.SetCellText(i, 0, "Boiler" + i);
oTable.SetCellText(i, 1, Pm.Round(Pm.Random(0, 100), 1));
oTable.SetCellText(i, 2, Minimum);
oTable.SetCellText(i, 3, Maximum);
}
// Setting the possibility to edit table columns:
oTable.SetCellEditable(-3, 0, 0);
oTable.SetCellEditable(-3, 1, 2);
oTable.SetCellEditable(-3, 2, 2);
Dim i, oTable, nRows, nCols, Minimum, Maximum
Set oTable = pMe
nRows = 101
nCols = 4
Minimum = 20
Maximum = 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"
' Text alignment of the table cells:
For i = 0 To nCols - 1
oTable.SetCellTextAlign -3, i, 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 i = 1 To nRows - 1
oTable.SetCellText i, 0, "Boiler" & i
oTable.SetCellText i, 1, Pm.Round(Pm.Random(0, 100), 1)
oTable.SetCellText i, 2, Minimum
oTable.SetCellText i, 3, Maximum
Next
' Setting the possibility to edit table columns:
oTable.SetCellEditable -3, 0, 0
oTable.SetCellEditable -3, 1, 2
oTable.SetCellEditable -3, 2, 2