Promotic
Login logon

onBeforeWriteValue - event of the PmfTableColumn object

Description:
The event is triggered before writing the value into the cell of the column.
Parameters:
ev(Object) Reference to an object that describes information about the event
Parameters:
ev.SrcObject(Object) Reference to the PmfTableColumn object where the event rises.
ev.Cell(Object) Reference to the PmfTableCell object.
Represents the table cell into which the new value is to be written.
ev.NewValue[for read and write] (Variant) New value of the table cell.
Note:
This event is is functional only in JavaScript language.
 
The event is triggered before writing into the cell in the script for example by assigning a value into the Value property or by calling the SetArray method.
The event is triggered also before writing into the cell after the cell editing is finished by pressing the Enter key or clicking outside the cell area.
The event is not triggered if the cell editing is cancelled by pressing the Esc key.
 
In this event it is not possible to write into the Value property of the PmfTableCell object. Changing the cell value can be done by writing into the ev.NewValue parameter.
See also:
- PmfTableColumn (object)
- PmfTableCell (object)
Example:
Script for example in the onFormLoad event of the PmgForm object:
JavaScriptSelect and copy to clipboard

var oForm = pMe.Form;
var oTable = oForm.CreateItem("table", "id_tab1");
oTable.InitRows(5, 1, 1);
oTable.InitCols(6, 1);
// ... Additional table settings

// The function is registered into the onBeforeWriteValue event.
function onWrite(ev)
{
Pm.Debug("PmfTableColumn.onBeforeWriteValue NewValue=" +ev.NewValue);
if (ev.NewValue > 100)
{
ev.Cell.BgColor = "#ff0000";   // Sets cell background color to red
}
else
{
ev.Cell.BgColor = "#00ff00";   // Sets cell background color to green
}
}
oColumn.AddEvent("onBeforeWriteValue", "Id_Write", onWrite);

History:
Pm9.00.32: Created
PROMOTIC 9.0.34 SCADA system documentation MICROSYS, spol. s r.o.

Send page remark Contact responsible person
© MICROSYS, spol. s r.o.Update cookies preferences