Update cookies preferences
Promotic

Opening the viewer of the PmaPanel object

The viewer of this object is opened by by the Pm.CreateView method, where in the sViewPath parameter the path to this object is entered.
Syntax:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(oFrom, sViewPath, sViewPars, sFramePars);
oCreator.Open();
Parameters of the Pm.CreateView method:
oFrom(Object) The object, which will mediate the opening of the viewer.
The object specifies the origin of the path, the relative position of the window, the parent, etc.
- The null value means the usage of:
- the PmaPanel object if CreateView method is called in the script of the Pmg object.
- active PmaWorkspace, if CreateView method is called in the script of the Pma object.
- If the the PmgFrame object is entered here (in the script of the Pmg object), then the viewer opens in this frame.
- If the the PmaPanel object is entered here (in the script of the Pma object), then the viewer opens in this selected object.

See the PmViewCreator.From property.
sViewPath(String) Path (relative or absolute) to the object or component whose viewer will be opened.
See the PmViewCreator.ViewPath property.
sViewPars(String) Viewer parameters (they differ for various viewer types).
See the PmViewCreator.View property.
Entries are in the KeyVal format. For example "pars:{boil:1;branch:A;}".

Properties and events in the PmViewCreator.View object:
pars(String) Parameters of the PmgRoot object representing the panel parameters and are all saved as pars on the embedded level. Either in embedded PmMap or in embedded KeyVal, depending on the usage of the viewer parameters.
Arguments(Variant) () Value passed to the panel viewer that is being opened. It can be a simple value (Integer, String, ...), array or object of the PmArray or PmMap type (it is not recommended to transfer objects of other types here).
This value is then available:
- in the onOpen event
- in the PmaPanel object by means of the PmgRoot.Arguments property
onOpen[optional] (Function) The event function for managing the event of viewer opening.
For JavaScript the function is entered.
For VBScript the PmAction object is entered.
 
The function has a single parameter ev containing information regarding the corresponding event.
ev.Arguments - (Variant) Input value of the viewer. See Arguments.
onClose[optional] (Function) The event function for managing the event of viewer closing.
For JavaScript the function is entered.
For VBScript the PmAction object is entered.
 
The function has a single parameter ev containing information regarding the corresponding event.
ev.CloseReason - (String) Identifier of the window closing type. See the sReason parameter in the PmgRoot.Close method.
ev.ReturnValue - (Variant) Output value of the viewer. See the PmgRoot.ReturnValue property.
sFramePars(String) Parameters for the frame where the viewer will be displayed.
See the PmViewCreator.Frame property.
Entries are in the KeyVal format, for example "target:_blank;".
The viewer parameters are in the form of the PmMap object that is filled from value of the sViewPars parameter (of the KeyVal type) in the Pm.CreateView method.
By filling from the KeyVal value all the parameters are initially stored as string. The content of the PmMap object can be then modified as needed - items can be modified, added and deleted.
The PmMap object can also contain other embedded PmMap objects (Submap). The PmMap.mapSetSubmapAt method can be used in order to create a new PmMap or make one accessible.

Example for opening of the panel without parameters in a separate window:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/Panel0", "", "target:_blank;");
oCreator.Open();


Example for opening of the panel and placing according to the Pmg object position:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/Panel0", "", "target:_blank;pos:view," + pMe.ViewX + "," + pMe.ViewY + ";");
oCreator.Open();


Example for opening of the panel with parameters (boil, branch) in a separate window:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/PanelBoil", "pars:{boil:1;branch:A;}", "target:_blank;");
oCreator.Open();
or by mapSetSubmapAt as follows:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/PanelBoil", "", "target:_blank;");
oCreator.View.mapSetSubmapAt("pars", "", "boil:1;branch:A;");
oCreator.Open();


Example for opening the modal panel with argument in a separate window:
JavaScriptSelect and copy to clipboard

function onClose(ev)
{
if (ev.CloseReason == "ok")
{
Pm.Debug("onClose ReturnValue=" + ev.ReturnValue);
}
}

var oCreator = Pm.CreateView(null, "/PanelModal", "", "target:_blank;dependent:1;pos:100,100;size:panel;modal:1;");
oCreator.View.Arguments = "Hello world!";
oCreator.View.onClose = onClose;
oCreator.Open();


Example for opening of the panel with the trend viewer:
Opening the panel with the trend viewer. The trConnect parameter contains the group-IDs and variable-IDs connected automatically when opening the panel.
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/PanelTrend", "pars:{trConnect:group0,temper,group0,pressure;}", "target:main;");
oCreator.Open();

History:
Pm9.00.09: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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