Filling up the table
The example fills up the column
Temperature of the table from the
example about the initialization of the table by values and the subsequent coloration of this column cells with respect to the
Minimum and
Maximum columns.
Let's have the
PmgWTable object in the
oTable variable placed
in the graphics editor.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var oTable = pMe;
oTable.SetCellText(0, 0, "Temperature");
oTable.SetCellText(0, 1, "Minimum");
oTable.SetCellText(0, 2, "Maximum");
var nRows = oTable.Rows - 1;
var iRow;
// *** Filling up the "Temperature" column with random values
var nTemperature;
var nMin = 20;
var nMax = 80;
for (iRow = 1; iRow <= nRows; iRow++)
{
oTable.SetCellText(iRow, 0, Pm.Round(Pm.Random(0, 100), 1));
oTable.SetCellText(iRow, 1, nMin);
oTable.SetCellText(iRow, 2, nMax);
}
// *** Checking the limits of values
for (iRow = 1; iRow <= nRows; iRow++)
{
nTemperature = Pm.Round(oTable.GetCellText(iRow, 0), 1);
nMin = Pm.Round(oTable.GetCellText(iRow, 1), 1);
nMax = Pm.Round(oTable.GetCellText(iRow, 2), 1);
// color setting by RGB String in the form "#RRGGBB" (LightBlue or LightRed)
oTable.SetCellBackColor(iRow, 0, nTemperature > nMin ? "#a8ccf0" : "#ff6868");
}
oTable.Draw();
Dim oTable
Set oTable = pMe
oTable.SetCellText 0, 0, "Temperature"
oTable.SetCellText 0, 1, "Minimum"
oTable.SetCellText 0, 2, "Maximum"
Dim nRows
nRows = oTable.Rows - 1
Dim iRow
' *** Filling up the "Temperature" column with random values
Dim nTemperature
Dim nMin
nMin = 20
Dim nMax
nMax = 80
For iRow = 1 To nRows
oTable.SetCellText iRow, 0, Pm.Round(Pm.Random(0, 100), 1)
oTable.SetCellText iRow, 1, nMin
oTable.SetCellText iRow, 2, nMax
Next
' *** Checking the limits of values
For iRow = 1 To nRows
nTemperature = Pm.Round(oTable.GetCellText(iRow, 0), 1)
nMin = Pm.Round(oTable.GetCellText(iRow, 1), 1)
nMax = Pm.Round(oTable.GetCellText(iRow, 2), 1)
' color setting by RGB String in the form "#RRGGBB" (LightBlue or LightRed)
If nTemperature > nMin Then
oTable.SetCellBackColor iRow, 0, "#a8ccf0"
Else
oTable.SetCellBackColor iRow, 0, "#ff6868"
End If
Next
oTable.Draw