Parameters of the
Pmg object are text constants (created by designer) that can be created
in any Pmg object.
Pmg object parameters are very similar to the
parameters of the Pma object.
If there are some
Pmg object parameters and if the mouse cursor hovers over this
Pmg object
in the graphics editor then these parameters (including values) are displayed in the status bar of the graphics editor.
The parameter has its name and value:
The parametr name: This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and first character must not be a number.
The
parameter value can be any text string.
Macro expression can be used for input (it is evaluated while the window is opening).
Parameter creation:
Reading and using parameters:
The parameter can be read:
- in the script
by the GetPar method.
Both approaches read parameter the
cascade way (bubbling), i.e. if the object (in which the macro/method is used), does not have this parameter, then the parameter is searched in its parents (in the immersed object) and finally it is searched in the
PmgRoot object.
The parameter is mainly used for configuration of
Pmg object
data bindings. In this case the
Pmg object (compound or single) can have more data bindings defined using this parameters such way, that the configuration change of parameter value will change the references to variables in this data bindings. Another possible usage of the parameter is for text parametrization in graphic objects
PmgString,
PmgButton, etc.
Parameter value change:
-
During application runtime the
Pmg object parameter value cannot be changed in general - it is used as constant.
The exception are the parameters of the
PmgRoot object. These parameters can be changed when opening the panel (contrary to the parameters in other
Pmg objects). Then, after the panel is open, these parameters are static and cannot be modified. The parameter values of the panel that are being open can be entered in two ways:
- when the
OpenView method is called in the
sParams parameter or
Example: It is possible to open the panel for the first time with the value of
1, for the second time with the value of
2 - and this way to display the panel for
"BoilerPlant1" and the second time for
"BoilerPlant2".
-
in the development environment it is of course possible to modify the values of all
Pmg objects (you can also add or remove parameters).
The main purpose of
Pmg object parameters is related to creation of
Pmg object interface. It is very easy to change the parameter values after copying the
Pmg object, so it displays the data, for example, not for
"Boiler1" but for
"Boiler2". This way the
Pmg object parameters make the creation of often used user
Pmg objects
in the graphics editor much easier.
The example of text parametrization:
in the
PmgString object create parameter named, for example,
BoilerNum, set the value to
1. In this object, fill in the "
Value" configurator:
The resulting displayed text:
Temperature in boiler 1
The example of the data binding parametrization:
Let´s have following data in the application:
"/Boiler1/Data" and
"/Boiler2/Data" of the same
PmaData type. Both objects contain predefined variable
"Temperature. Additional two objects for displaying both temperatures are located in the
/PanelBoiler panel. If another object is added in the future, e.g. Boiler3, the new object created just by copying the existing object should display the temperature of a new object.
Solution:
- In the
PmgString object (displaying the temperature) create parameter named, for example,
BoilerNum, set the value to
1.
- In the "
Value" configurator of this object create the "
PP - Pma object property" data binding. In data binding enter:
- The "
Object" configurator with the following text:
$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")
- The "
Property" configurator will be filled in automatically with the
Value text.
This way the
Pmg object is configured properly. Now it is possible to copy the object and just by changing the parameter value
BoilerNum to
2 in this copy, to let the
Pmg object display the value of
/Boiler2/Data/#vars/Temperature. Any time in the future it is possible to change the object parameter and thus change the target object of the displayed value.
The example of creating panel with parameter:
Let´s have following data in the application:
"/Boiler1/Data" and
"/Boiler2/Data" of the same
PmaData type. Both objects contain predefined variable
"Temperature. There is the "
/PanelBoiler" panel that displays the temperature of
"Boiler1" or of
"Boiler2" (according to the open window parameters).
Solution:
- In the
/PanelBoiler panel, in the
PmgRoot object, create parameter named
BoilerNum.
- Create a
Pmg object, for example,
PmgString (will display the temperature value). In the "
Value" configurator create the "
PP - Pma object property" data binding. In the data binding enter:
- The "
Object" configurator with the following text:
$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")
- The "
Property" configurator will be filled in automatically with the
Value text.
This way the panel is filled in correctly. Now you just have to assure to open the panel always with the correct parameter. For example create another panel that will be used for opening the "
/PanelBoiler" panel. Insert two buttons (
PmgButton Pmg objects) into this panel. The first button will open the panel for
"Boiler1", the second button will open the same panel but for
"Boiler2". Into the
onButtonUp event of the first button enter this script:
Into the same event of the second button enter similar script:
Launch the application and open the window with buttons.
After pressing the first button the window for
"Boiler1" is opened.
After pressing the second button the window for
"Boiler2" is opened.