Update cookies preferences
Promotic

Items - method of the PmgObject object

Description:
Returns reference to the Pmg object in the panel.
Syntax:
Object Items(String sPath, [Long nAttr])
Parameters:
sPath(String) Relative or absolute path to the Pmg object or its implementation subobject (case sensitive text).
The path describes the location of the object in the tree structure of the immersed Pmg objects. Each tree level adress is separated by the / character. The immersed Pmg object is referenced by its name. The superior Pmg object is referenced by .. characters. The absolute path starts with the / character and describes the path to the Pmg object from beginning of the tree structure. The relative path starts with the name of the immersed Pmg object or by reference to superior Pmg object by .. characters, or by reference to itself ., describes the path to another Pmg object relative to itself.
The immersed implementation subobject (other than PmgObject type) is referrenced by # character, followed by the implementation subobject type definition (e.g. #vars). It means that the # addressing leaves the panel Pmg objects tree and starts to address the implementation subobjects. For example "/text0/#vars/Temperature".
#vars - Enables the variables of the Pmg object.
The variable of the Pmg object can be reached by two ways:
1) From the Pmg object by the Vars method. For example pMe.Items("/text0").Vars("Temperature").Value
2) By setting the path to the Pmg object extended by access to implementation object by #vars. For example pMe.Items("/text0/#vars/Temperature").Value
Note! The way of entering the path down to the specific variable of the Pmg object can be used in the PmgObject.Items method, in the "GP - Pmg object property" data binding and also in #pragma variable x = PmgObjectRef("path").
nAttr[optional] (Long) It allows to change the behavior of the method.
0 (default) - Default behavior.
1 - When referencing the non-existing object, the global error of the INFO system will not be generated.
Note:
In order to create the variable of the Object type containing reference to Pmg object or its implementation subobject see also: #pragma variable x = PmgObjectRef("path").

This method is also functional in Web panels. It is functional also the #pragma entry, see Example4.
Example1:
The most common usage of this property is in events of Pmg objects (e.g. in PmgButton.onButtonUp). The pMe parameter present in these events can be used to access other Pmg objects.
JavaScriptVBScriptSelect and copy to clipboard

pMe.Items("../text0").Visible = 0;
Example2:
Let's have the reference to the PmgBox object in the oBox. In the oBar0 there is consequentially the reference to the PmgBar object named "Bar0" that is nested into the oBox
JavaScriptVBScriptSelect and copy to clipboard

var oBox = pMe.Items("/Box");
var oBar0 = oBox.Items("Bar0");
oBar0.Value = 100;
Example3:
Writing the 0 value into the "Temperature" variable of the Pmg object "text0" immersed into the parent object named "box0". The reference to the object is absolute.
JavaScriptVBScriptSelect and copy to clipboard

// Writing the 0 value into the "Temperature" variable of the Pmg object "text0" immersed into the parent object named "box0". The reference to the object is absolute.
pMe.Items("/box0/text0/#vars/Temperature").Value = 0;

// Writing the 0 value into the "Temperature" variable in my own Pmg object. The reference to the object is relative.
pMe.Items("./#vars/Temperature").Value = 0;

// Writing the 0 value into the "Temperature" variable in superior Pmg object. The reference to the object is relative.
pMe.Items("../#vars/Temperature").Value = 0;

// Writing the 0 value into the "Temperature" variable of the Pmg object "text1" immersed into my superior Pmg object. The reference to the object is relative.
pMe.Items("../text1/#vars/Temperature").Value = 0;
Example4:
Let's have the reference to the PmgBar object in the oBar0 named "Bar0" that is nested into another Pmg object.
Let's have nested the PmgBar object on the same level named "Bar1".
In the oBar1 there is consequentially the reference to the PmgBar object named "Bar1".
JavaScriptVBScriptSelect and copy to clipboard

var oBar0 = pMe.Items("/Box/Bar0");
var oBar1 = oBar0.Items("../Bar1");
oBar1.Value = 100;
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.