The
Pma object parameters are (designer created) constants, that can be created in all
Pma objects. It is used for application parametrization. It is used especially in the concept of prototypes and instances, where different instances of the same prototype can be distinguished. See the "
Pma object parameters" configurator.
The
Pma object parameters are very similar to the
Pmg object parameters.
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 after the application is launched).
Caution! If the parameter value is entered by macro expression, then the reference to
Pma object parameter (
Macro expression $.par) will lead to the parameters of the parent, because the parameters of this
Pma object do not exist yet (are being defined).
The
Pma object parameter can be read by the
PmaObject.GetPar method, but mainly the parameter can be used as
Macro expression $.par in configurators of
Pma objects. Both approaches read the parameter the
cascade way (bubbling), i.e. if the
Pma object, that uses the macro/method, does not have this parameter, then the parameter is searched in its parent. This procedure is repeated until the parameter is found. The parameter search procedure (bubbling) ends in the
PmaRoot object, that is the parent of all
Pma objects.
Caution for prototypes and instances: The
PmaInstance object can receive only the parameters from the corresponding
PmaPrototype object, and can enter
modified values there. It means that the instance can modify the existing parameter values of the corresponding prototype. The instance, or the instance parents, cannot add new parameters. Instance (prototype) can access only the parameters defined in the prototype, but cannot access the parameters of instance parent. This way it is ensured that all instances of the individual prototype has the same set of parameters with different values. The
PmaInstance object is therefore special from the parameter searching (bubbling) point of view, because the parameter search is terminated in this object and does not continue to the
PmaInstance object parent. This way the instance of the prototype is isolated from other parameters present in the application. If it is necessary to obtain the value of the parameter for the prototype from the instanece parent, then the parameter must be created in the
PmaPrototype object (the name can be the same or different) and refer to the parameter of the instance parent either here or in the
PmaInstance object. The reference to the parent parameter is done by
Macro expression $.par in the parameter value in the instance or prototype.
For example in the prototype, create a new
boiler parameter, and link the value to the
boiler parameter value of the instance parent:
boiler:$.par("boiler");
The relation between Pma objects and Pmg objects:
It is important that it is possible to deliver the
Pma object parameter into the panel as a
Pmg object parameter. The basic principle is that the
Pma object parameter cannot get inside the panel automatically (the
Pmg object cannot directly "see" the parameter defined outside the panel). It is necessary to to create the corresponding parameter in the
PmgRoot object and set it to the value of the
Pma object parameter when opening the panel. This can be done: