Promotic

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 iRow, iCol;
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 (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, Minimum);
oTable.SetCellText(iRow, 3, Maximum);
}

// Setting the possibility to edit table columns:
oTable.SetCellEditable(-3, 0, 0);
oTable.SetCellEditable(-3, 1, 2);
oTable.SetCellEditable(-3, 2, 2);
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.