Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Object PmForm (Form)

Description:
This 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:
PmFormItemString Text input
PmFormItemInt Real number input (Integer)
PmFormItemFloat Real number input (Float)
PmFormItemBool Boolean value input item (Checkbox)
PmFormItemEnum Select one of multiple items (Combobox)
PmFormItemButton Button
PmFormItemSepar Separator between configurators
PmFormItem Formal object - parent of all form items
Note:
- 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" is represented by a 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 automaticaly as needed.

 
Form creation procedure:
Creating 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:
Example for JavaScript language:
// Creating form object:
var oItem, oForm = Pm.CreatePmForm();
oForm.Title = "Package storage parameter input";
// Creating 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");
// Opening form in modal window:
var oExtra = Pm.CreatePmMap();
oExtra.onChange = Pm.CreatePmAction(1, pMe, "FormChanged");
oExtra.onClose = Pm.CreatePmAction(1, pMe, "FormClosed");
-----------
2. When entering values into the form the user method "FormChanged" is called each time any modification is done in the form. This way it is possible, for example, to detect that the "Zero in" button was pressed and all entries can be zeroed.

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

Example for JavaScript language:
{
  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 "FormClosed" user method is called. All entered values cen be detected here.

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

Example for JavaScript language:
{
  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;
}
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice