Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Parameters of graphic item

Parameters of graphic item are text constants (created by designer) that can be created in any graphic item.

Graphic item parameters are very similar to the parameters of PROMOTIC object.

If there are some item parameters then these parameters (including values) are displayed in the status bar of the panel editor while the mouse pointer hovers over the item.

 
The parameter has its name and value:
The parameter name is a system name (no diacritics, no spaces, must start with a letter).
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:
- PmiRoot graphic item parameters are defined in the PmiRoot > Panel > Item parameters configurator.
- Parameters for other items are defined in the PmiItem > Object > Item parameters configurator.
 
Reading and using parameters:

The parameter can be read:

- in script by the GetPar method.
- in configurators by using the macro expressions $.par (e.g. for data binding definition.

Both approaches read parameter the cascade way (bubbling), i.e. if item (in which the macro is used), does not have this parameter, then this parameter is searched in its parents (in the immersed item) and finally it is searched in PmiRoot item.

The parameter is mainly used for configuration of graphic item data binding. In this case the graphic item (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 items in this data bindings. Another possible usage of parameter is for text parametrization in PmiText, PmiButton, etc. items.

 
Parameter value change:
- During application runtime the parameter value cannot be changer in general - it is used as constant.

The exception are the parameters of PmiRoot graphic item. These parameters (opposed to the parameters in other graphic items) can be modified when the panel is opened. Then, after the panel is open, these parameters are static and cannot be modified. The parameter values of panels that are being open can be defined in two ways:

- while calling the OpenView method 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 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 graphic items (you can also add or remove parameters).

The main purpose of item parameters is related to creation of item interface. It is very easy to change the parameter value after copying the item, so it displays the data, for example, not for "Boiler1" but for "Boiler2". This way the item parameters make the creation of often used user graphic items in panel editor much easier.


An example of text parametrization:

In the PmiText graphic item create parameter named, for example, BoilerNum, set the value to 1. In this graphic item, fill in the Text configurator:

$.join("Temperature in boiler", $.par("BoilerNum"))

The resulting displayed text: Temperature in boiler 1


An example of data binding parametrization:

Let´s have following data in the application: "/Boiler1/Data" and "/Boiler2/Data" of the same PmData type. Both objects contain predefined variable "Temperature. Additional two items displaying both temperatures are located in the /PanelBoiler panel. If another object is added in the future, e.g. Boiler3, then the new item created just by copying the existing item should display the temperature of the new object.

Solution:

- In the graphic item of PmiText type (displaying the temperature) create parameter named, for example, BoilerNum, set the value to 1.
- In the item Text configurator create data binding PP - Binding to Promotic object property. In data binding fill in:
- The Object configurator with the following text:

$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")

- The Property configurator will be filled in autoaticaly with the Value text.

This way the graphic item is configured properly. Now it is possible to copy the graphic item and just by changing the parameter value BoilerNum to 2 in this copy, to let the graphic item display the value of /Boiler2/Data/#vars/Temperature. Any time in the future it is possible to change the graphic item parameter and thus change the target object of the displayed value.


Example of creating panel with parameter:

Let´s have following data in the application: "/Boiler1/Data" and "/Boiler2/Data" of the same PmData 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 PmiRoot graphic item, create parameter named BoilerNum.
- Create a graphic item named, for example, PmiText (will display the temperature value). In the Text configurator create a data binding PP - Binding to Promotic object property. In the data binding fill in:
- The Object configurator with the following text:

$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")

- The Property configurator will be filled in autoaticaly 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 (graphic item PmiButton) 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 event onButtonUp of the first button enter this script:

pMe.PmPanel.OpenView "/PanelBoiler", "", "par:BoilerNum=1;"

Into the same event of the second button insert similar script:

pMe.PmPanel.OpenView "/PanelBoiler", "", "par:BoilerNum=2;"

Launch the application and open the panel with buttons. By pressing the first button the window for "Boiler1" is opened, by pressing the second button the window for "Boiler2" is opened.

© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice