Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Items - method of object PmiItem

Description:
Returns reference to the graphic item in the panel.
Syntax:
Items(sPath As String, [nAttr As Long]) As Object
Calling:
Set oItem = oItem.Items(sPath)
Parameters:
sPath(String) Relative or absolute path to the graphic item or its implementation subobject (case sensitive text).

The path describes the location of the object in the tree structure of the immersed graphic items. Each tree level adress is separated by the / character. The immersed graphic item is referrenced by its name. The superior graphic item is referrenced by .. characters. The absolute path starts with the / character and describes the path to the graphic item from the beginning of the tree structure. The relative path starts with the name of the immersed item or by reference to superior graphic item by .. characters, or by reference to itself ., describes the path to another graphic item relatively to itself.

The immersed implementation subobject (other than PmObject type) is referrenced by # character, followed by the implementation subobject type definition (e.g. #vars). It means that the # addressing leaves the panel graphic items tree and starts to address the implementation subobjects. For example "/text0/#vars/Temperature".

#vars - Enables the variables of the graphic item.

The variable of graphic item can be reached by two ways:

1) From the graphic item by the Vars method. For example pMe.Items("/text0").Vars("Temperature").Value
2) By setting the path to the graphic item 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 a graphic item can be used in the PmiItem.Items method, in GP binding and also in #pragma variable x = PmiItemRef("path").

nAttr[optional] (Long) Enables to change the behavior of the method.
0 (default) - default behavior.
1 - when referencing the non-existent graphic item the global error in the INFO system won't be generated.
Note:

In order to create the Object type variable containing reference to graphic item or its implementation subobject. See also: #pragma variable x = PmiItemRef("path").

 
The method can also be called in the graphic item events for Web panels. The #pragma entry is functional too, see Example4.
Example1:
The most common usage of this property is the graphic item event cathegory (e.g. in PmiButton.onButtonUp). The pMe parameter present in these events can be used to access other graphic items.
JavaScriptVBScriptSelect and copy to clipboard

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

var oPanel = pMe.Items("/Panel");
var oBar0 = oPanel.Items("Bar0");
oBar0.Value = 100;
Example3:
Writing the 0 value into the variable "Temperature" of the "text0" graphic item immersed into the superior item named panel0. The reference to the item is absolute.
JavaScriptVBScriptSelect and copy to clipboard

//Writing the 0 value into the variable "Temperature" of the "text0" graphic item immersed into the superior item named panel0. The reference to the item is absolute.
pMe.Items("/panel0/text0/#vars/Temperature").Value = 0;

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

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

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

var oBar0 = pMe.Items("/Panel/Bar0");
var oBar1 = oBar0.Items("../Bar1");
oBar1.Value = 100;
PROMOTIC 8.3.27 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