Promotic
WikipediaLinkedInYoutubeTwitterFacebook

OpenViewModal - method of object PmaPanel

Description:
The method opens viewer of another object in the modal window.

This method is obsolete (but functional), is not functional in modern Web browsers, it is better to use the PmaPanel.OpenView method. See How to work with modal windows.

Syntax:
Variant OpenViewModal(String sObjectPath, [String sOptions], [String sParams], [Variant vArguments])
Calling:
val = oPanel.OpenViewModal(sObjectPath, sOptions, sParams, vArguments)
Parameters:
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 KeyVal format, for example "target:_blank;modal:1;".

For detailed description see sOptions.

sParams[optional] (String) Parameters transferred to the object that is to be viewed by the corresponding viewer.

Entries are in 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 typically read in the onPanelStartEnd event and it serves for passing the input data to the opened window directly from the script.
Return Values:
The method returns the Empty value if the Cancel button (or Esc key) is pressed in the modal window. The Pm.IsValid method can be used for testing.

After pressing the OK button, the value entered in this window is returned (see the note below).

Note:
The method is synchronous, i.e. 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 vindow. 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 windows (the forms) 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.
Example:
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 parameter vArguments. 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.CreatePmArray().Array1("text 0", 5);
var r = pMe.PmPanel.OpenViewModal("/Panel3", "", "par: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.CreatePmArray().Array1(r0, r1);

History:
Pm7.03.10: Created
PROMOTIC 9.0.7 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