OpenViewModal - method of the PmaPanel object

The method opens the viewer of another object in a modal window.
This method is obsolete (but functional), is not functional in modern Web browsers and it is better to use the Pm.CreateView method. See How to work with modal windows.
Variant OpenViewModal(String sObjectPath, [String sOptions], [String sParams], [Variant vArguments])
sObjectPath(String) Path (relative or absolute) to the object or component whose viewer will be opened.
For detailed description see sObjectPath.
sOptions[optional] (String) The parameters transferred to the viewer. These define where and how to open the viewer.
Entries are in the KeyVal format, for example "target:_blank;modal:1;".
For detailed description see sOptions.
sParams[optional] (String) The data transferred to the object that is to be viewed by the corresponding viewer.
Entries are in the KeyVal format, for example "name1:value1;name2:value2;".
For detailed description see sParams.
vArguments[optional] (Variant) The value that is automatically passed into the Arguments property.
The value of this property is usually read in the onPanelStartEnd event and it serves for passing the input data to the opened window directly in the script.
Return value:
After pressing the OK button, the value entered in this window is returned (see the note below).
If the "Cancel" button (or Esc key) is pressed in a modal window then the method returns: null for JavaScript or Empty for VBScript (it can be tested by the Pm.IsValid method).
The method is synchronous, it means that the script continues with the following statement after the modal window is terminated. For opening the viewer the permission must be set in the opening object. For example for the PmaPanel object: permission PanelOpen or WebRead, etc.

Input and output values for modal PmaPanel:
Two properties are essential for modal opening of the PmaPanel object viewer:
- PmgRoot.Arguments: Input value for opening modal window. This value is copied from the vArguments parameter of this method.
- PmgRoot.ReturnValue: Output value defined by closing the modal window by the "OK" button. In such case the value present in this property is returned as ouitput value of this method.

This concept allows to create the window (the form) where the panel content is not directly connected (by bindings, script) with the application, but the whole initial state of the window is passed by the input parameter and the whole state after editing the content is passed by the return value.
For passing multiple values by a single parameter the VBScript.Array function can be used.

This method is also functional in Web panels.
Opens panel in a new modal window and sets both the value of the parameter nmb of the panel and the array of 2 values in the vArguments parameter. Followed by the check, whether the modal window has transferred the reversal value (by means of the PmgRoot.ReturnValue property) after the termination (e.g. by the "OK" button). If yes, then the debug entry of this value is written into the INFO system. This script can be, for example, in the onButtonUp event of the PmgButton object.
Script calling the modal window:
JavaScriptVBScriptSelect and copy to clipboard

var arr = Pm.Array1("text 0", 5);
var r = pMe.PmPanel.OpenViewModal("/Panel3", "", "pars:{nmb:2;}", arr);

if (Pm.IsValid(r))
Pm.Debug(r, 1);
Script in the PmgRoot.onPanelStartEnd event (parameters are entered in 2 PmgString objects):
JavaScriptVBScriptSelect and copy to clipboard

var a = pMe.Arguments;
pMe.Items("/text0").Value = a.GetItem(0);
pMe.Items("/text1").Value = a.GetItem(1);
Script in the PmgRoot.onPanelStopEnd event (values of 2 PmgString objects are written into the return values):
JavaScriptVBScriptSelect and copy to clipboard

var r0 = pMe.Items("/text0").Value;
var r1 = pMe.Items("/text1").Value;
pMe.ReturnValue = Pm.Array1(r0, r1);

Pm8.02.14: Method was not able to return the value of the Date type.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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