Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Example: Creates PmForm window with data entry items

In a single script (e.g. after pressing the button in the onButtonUp event) a form is created, set and open:
JavaScriptSelect and copy to clipboard

//Creates a form object
var oForm = Pm.CreatePmForm();
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;
oEnum1.AddEvent("onEditAccept", function(ev) { if (oEnum1.Value == 9.9) oStr1.Value = "fast - Packed water"; });

//PmfString
var oStr1 = oForm.CreateItem("string", "s1", "Description");
oStr1.Value = "Packed water";

//PmfButton
var oBtn1 = oForm.CreateItem("button", "reset", "Zero in");
oBtn1.Value = "Reset";
oBtn1.AddEvent("onAction", function(ev) { if (ev.Action == "main") { oNmb1.Value = 5; oBool1.Value = true; oEnum1.Value = 0.5; oStr1.Value = "Packed water"; } });

//Opens form in modal window:
var oExtra = Pm.CreatePmMap();
oExtra.ViewObject = oForm;
oExtra.onClose = function(ev) { Pm.Debug("n1 = " + oNmb1.Value + ", b1 = " + oBool1.Value + ", e1 = " + oEnum1.Value + ", s1 = " + oStr1.Value); };
pMe.PmPanel.OpenView("/#glob/form", "target:_blank;modal:1;", "", oExtra);
PROMOTIC 9.0.8 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice