Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Object PmForm (Form)

Description:
Object represents a form used for data entry.
Properties and methods:
AddEvent Registers a function into selected event
BgColor Form window background color
ClientType Returns value that represents Pmf object viewing type
Close Close form viewer
CreateItem Creates a single list item
GetItem Returns Pmf object (i.e. existing form item)
GetItems Returns array of Pmf objects.
PrivateData Reading or writing private value into/from PmForm object
RemoveEvent Deregisters the function in the specified event
RemoveItem Removes Pmf object (i.e. existing form item)
RemoveItems Removes items of the Pmf object.
SysButtons System buttons selection
SysLayoutPos Position of the system area $sys
Title Displayed form name in the window title bar
List of Pmf subobjects:
PmfBool Boolean value input item (Checkbox)
PmfButton Button
PmfEnum Selection of one of multiple items (Combobox)
PmfLayout Area for other Pmf objects
PmfNumber Integer or real number input
PmfObject Formal object - parent of all form items
PmfSepar Separator between configurators
PmfString Text input
PmfTable Table
Events:
onClose Is triggered on closing of the PmForm.
onOpen Is triggered on opening of the PmForm.
Note:
- The object can be created by the method Pm.CreatePmForm.
- This object is functional also in Web panels.
- 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 Pmf object, alias one item of the form.

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

In the PmaPanel object it is also possible to use the PmForm object by means of the PmgForm object.

 
Main areas for placing the Pmf objects:

The PmForm object automatically creates several system areas (of the PmfLayout type objects).

All these objects have an identifier beginning with the $ character.

$root: Is a system parent of the areas $main and $sys
$main: Main area that is default for creating all Pmf objects by the PmForm.CreateItem method.
- This PmfLayout is preset to have "Subtype:vert" so all objects created in it will be placed vertically (i.e. one uder the other).
$sys: System area where the application designer can place Pmf objects.
- This area is displayed only if there are some Pmf objects present.
- If the area is displayed then the preset placement is to the right from the area $main. The placement can be modified by means of the PmForm.SysLayoutPos property.
 
Form creation procedure:
Creates a modal window for data input of values
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);

History:
Pm9.00.05: PmfObject.AddEvent new method for registration of a function that is called when the event in the object is created.
Pm9.00.04: New subobject PmfTable that can be used to assign a table of values into the form.
Pm8.03.17: Fixed bug: System buttons had only English texts.
Pm8.03.15:
- In each PmfObject object there are new properties TitlePos, BodyWidthMode, BodyWidthIni, BodyHeightMode, BodyHeightIni.

These properties can be used for better positioning of configurators.

- In the PmfString object there are new properties Multiline and Subtype. It is now possible to create multi-row input box, static notes, etc.
- In the PmfSepar object there is a new property Subtype. It is now possible to insert empty rows between the configurators.
Pm8.03.09:
- New Pmf object type - separator, i.e. PmfSepar object.
- Close new method and new properties BgColor, SysButtons.
Pm8.03.08: Allows creation of forms for data entry. Opens by the OpenView type method i.e. it can be open in an independent window, in the PmgFrame object, or in PmaWorkspace. It is functional also in Web panels. Replaces the obsolete method Pm.InputBox.
PROMOTIC 9.0.7 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