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 i, Temperature, Minimum, Maximum;
var oTable = pMe;
var nRows = oTable.Rows - 1;
oTable.SetCellText(0, 0, "Temperature");
oTable.SetCellText(0, 1, "Minimum");
oTable.SetCellText(0, 2, "Maximum");
// *** Filling up the "Temperature" column with random values
Minimum = 20;
Maximum = 80;
for (i = 1; i <= nRows; i++)
{
oTable.SetCellText(i, 0, Pm.Round(Pm.Random(0, 100), 1));
oTable.SetCellText(i, 1, Minimum);
oTable.SetCellText(i, 2, Maximum);
}
// *** Checking the limits of values
for (i = 1; i <= nRows; i++)
{
Temperature = Pm.Round(oTable.GetCellText(i, 0), 1);
Minimum = Pm.Round(oTable.GetCellText(i, 1), 1);
Maximum = Pm.Round(oTable.GetCellText(i, 2), 1);
// color setting by RGB String in the form "#RRGGBB" (LightBlue or LightRed)
oTable.SetCellBackColor(i, 0, Temperature > Minimum ? "#a8ccf0" : "#ff6868");
}
oTable.Draw();
Dim i, Temperature, Minimum, Maximum, oTable, nRows
Set oTable = pMe
nRows = oTable.Rows - 1
oTable.SetCellText 0, 0, "Temperature"
oTable.SetCellText 0, 1, "Minimum"
oTable.SetCellText 0, 2, "Maximum"
' *** Filling up the "Temperature" column with random values
Minimum = 20
Maximum = 80
For i = 1 To nRows
oTable.SetCellText i, 0, Pm.Round(Pm.Random(0, 100), 1)
oTable.SetCellText i, 1, Minimum
oTable.SetCellText i, 2, Maximum
Next
' *** Checking the limits of values
For i = 1 To nRows
Temperature = Pm.Round(oTable.GetCellText(i, 0), 1)
Minimum = Pm.Round(oTable.GetCellText(i, 1), 1)
Maximum = Pm.Round(oTable.GetCellText(i, 2), 1)
' color setting by RGB String in the form "#RRGGBB" (LightBlue or LightRed)
If Temperature > Minimum Then
oTable.SetCellBackColor i, 0, "#a8ccf0"
Else
oTable.SetCellBackColor i, 0, "#ff6868"
End If
Next
oTable.Draw