Object PmForm (Form)

Object represents a form used for data entry.
Properties and methods:
CreateItem Creates a single list item
GetItem Returns existing form item
Title Displayed form name in the window title bar
BgColor Form window background color
SysButtons System buttons selection
Close Close form viewer
List of subobjects:
PmfString Text input
PmfInt Real number input (Integer)
PmfFloat Real number input (Float)
PmfBool Boolean value input item (Checkbox)
PmfEnum Selection of one of multiple items (Combobox)
PmfButton Button
PmfSepar Separator between configurators
PmfObject Formal object - parent of all form items
- The object can be created by the method Pm.CreatePmForm.
- This object is functional also for Web panels. It is not functional in InternetExplorer8 and lower.
- The object can be used in both VBScript and JavaScript languages.
The PmForm object can be used to create a data input window (form) dynamicaly (i.e. by script). Each "input value" represents one form item.

The form can also be created by the PmPanel object, but the PmForm object allows to create such form dynamicaly and more simply, because the form items are positioned and resized automatically as needed.

Form creation procedure:
Creates a modal window for data input of values
1. In a single script (fired e.g. by button press in onButtonUp event) a form is created, set and open:
JavaScriptSelect and copy to clipboard

//Creates a form object
var oItem;
var oForm = Pm.CreatePmForm();
oForm.Title = "Package storage parameter input box";

//Creates form entries:
oItem = oForm.CreateItem("int", "i1", "Number of packages", "Min:0;Max:33;");
oItem.Value = 5;
oItem = oForm.CreateItem("bool", "b1", "Store");
oItem.Value = true;
oItem = oForm.CreateItem("string", "s1", "Description");
oItem.Value = "Packed water";
oItem = oForm.CreateItem("enum", "e1", "Processing speed");
oItem.AddRow(0.5, "slow");
oItem.AddRow(9.9, "fast");
oItem.Value = 0.5;
oItem = oForm.CreateItem("button", "reset", "Zero in");

//Opens form in modal window:
var oExtra = Pm.CreatePmMap();
oExtra.ViewObject = oForm;
oExtra.onChange = Pm.CreatePmAction(1, pMe, "FormChanged");
oExtra.onClose = Pm.CreatePmAction(1, pMe, "FormClosed");
pMe.PmPanel.OpenView("/#glob/form", "target:_blank;modal:1;", "", oExtra);
2. When entering values into the form the designer's method "FormChanged" is called each time any modification is done in the form (see oExtra.onChange). This way it is possible, for example, to detect that the "Zero in" button was pressed and all entries can be zeroed.

This designer's method is created on the Methods page and must have two parameters: oSystem and oPrivate.

JavaScriptSelect and copy to clipboard

if (oSystem.ChangeType == "push" && oSystem.ItemId == "reset")
  var oForm = oSystem.ViewObject;
  oForm.GetItem("i1").Value = 0;
  oForm.GetItem("b1").Value = false;
  oForm.GetItem("s1").Value = "";
  oForm.GetItem("e1").Value = 0.5;
3. After the data entry is completed and the window closed the designer's method "FormClosed" is called. All entered values cen be detected here.

This designer's method is created on the Methods page and must have two parameters: oSystem and oPrivate.

JavaScriptSelect and copy to clipboard

if (oSystem.CloseReason == "ok")
  var oForm = oSystem.ViewObject;
  var val1 = oForm.GetItem("i1").Value;
  var val2 = oForm.GetItem("b1").Value;
  var val3 = oForm.GetItem("s1").Value;
  var val4 = oForm.GetItem("e1").Value;
PROMOTIC 8.3.30 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