Example: Creates items for entering data in the PmgForm object
In the script in the
PmgForm.onFormLoad event a form is created:
JavaScriptSelect and copy to clipboard
// Creates a form object
var oForm = pMe.Form;
oForm.Title = "Package storage parameter input box";
// Creates form items (Pmf objects):
// ------------ PmfNumber:
var oNmb1 = oForm.CreateItem("number", "n1", "Number of packages", "Min:0;Max:33;");
oNmb1.Value = 5;
// ------------ PmfBool:
var oBool1 = oForm.CreateItem("bool", "b1", "Store");
oBool1.Value = true;
// ------------ PmfEnum:
var oEnum1 = oForm.CreateItem("enum", "e1", "Processing speed");
oEnum1.AddRow(0.5, "slow");
oEnum1.AddRow(9.9, "fast");
oEnum1.Value = 0.5;
function onEnum1EditAccept(ev)
{
if (oEnum1.Value == 9.9)
{
oStr1.Value = "fast - Packed water";
}
}
oEnum1.AddEvent("onEditAccept", "ChangeEnum", onEnum1EditAccept);
// ------------ PmfString:
var oStr1 = oForm.CreateItem("string", "s1", "Description");
oStr1.Value = "Packed water";
// ------------ PmfButton:
var oBtn1 = oForm.CreateItem("button", "reset", "Zero in");
oBtn1.Value = "Reset";
function onBtn1Reset(ev)
{
if (ev.Action == "main")
{
oNmb1.Value = 5;
oBool1.Value = true;
oEnum1.Value = 0.5;
oStr1.Value = "Packed water";
}
}
oBtn1.AddEvent("onAction", "ResetButton", onBtn1Reset);