OpenViewModal - method of object PmPanel

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

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

OpenViewModal(sObjectPath As String, [sOptions As String], [sParams As String], [vArguments As Variant]) As Variant
val = oPanel.OpenViewModal(sObjectPath, sOptions, sParams, 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 transfered to the viewer. These define where and how to open the viewer.

Entries with assigned value are separated by a semicolon, for example "target:_blank;modal:1;".

For detailed description see sOptions.

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

Entries with assigned value are separated by a semicolon, for example "name1:value1;name2:value2;".

For detailed description see sParams.

vArguments[optional] (Variant) The value that is automatically passed to 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 (or Esc key) is pressed in the modal window. The Pm.IsValid method can be used for testing.

If the OK button is pressed then the value entered in this window is returned (see the note below).

The method is synchronous, i.e. the script continues with the following command after the modal window is terminated. For opening the viewer the permission has to be set in the opening object. For example for PmPanel object there is permission PanelOpen or WebRead, etc.
Input and output values for modal PmPanel:

Two properties are essential for modal opening of PmPanel viewer:

- PmiRoot.Arguments: Input value for opening modal vindow. This value is copied from the vArguments parameter of this method.
- PmiRoot.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 method can be used easily.

The method can also be called in the graphic item events for 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 parameter vArguments. Followed by the check, whether the modal window has transfered the reversal value (using the PmiRoot.ReturnValue property) after the termination (e.g. by the OK button). If yes, the debug entry of this value is written into the INFO system. This script can be, for example, in the onButtonUp event of the PmiButton graphic item.
Script code calling the modal window.
Dim r, a0, a1
a0 = "text 0"
a1 = 5
r = pMe.PmPanel.OpenViewModal("/Panel3", "", "par:nmb=2;", Array(a0, a1))
If Pm.IsValid(r) Then
  Pm.Debug r, 1
End If
Script code of the PmiRoot.onPanelStartEnd event (parameters are entered in 2 PmiText items).
Dim a
pMe.Items("/text0").Value = a(0)
pMe.Items("/text1").Value = a(1)
Script code of the PmiRoot.onPanelStopEnd event (values of 2 PmiText items are written into the return values).
Dim r0, r1
r0 = pMe.Items("/text0").Value
r1 = pMe.Items("/text1").Value
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice