The modal window is usually used for data entry (editing). The user is entering the entries and before the proces is completed the user is prevented from "leaving the window".
While the modal window is open, access the rest of the application is blocked, therefore it is necessary to think well before using such window. It is recommended to use such window only for simple data entry so it is not open for a long time.
var aArg = pMe.Arguments;
pMe.Items("/WCombo").SelectedIndex = aArg.GetItem(0);
pMe.Items("/WCheck").Value = aArg.GetItem(1);
pMe.Items("/WEdit").Value = aArg.GetItem(2);
if (pEvent.Reason == "ok")
var aVal = Pm.CreatePmArray().Create(3);
var v1 = pMe.Items("/WCombo").SelectedIndex;
var v2 = pMe.Items("/WCheck").Value;
var v3 = pMe.Items("/WEdit").Value;
aVal.SetItem(v2 = v2 ? -1 : 0, 1);
pMe.ReturnValue = aVal;
Then the modal window is opened. Once it is closed, the returned value is processed in the "onClose" function.
if (ev.CloseReason == "ok")
var val0 = arr.GetItem(0);
var val1 = arr.GetItem(1);
var val2 = arr.GetItem(2);
Pm.Debug("val0=" + val0 + ", val1=" + val1 + ", val2=" + val2);
var arr = Pm.CreatePmArray().Array1(2, -1, "Promotic");
var oCreator = Pm.CreateView(pMe.PmPanel, "/PanelModal", "", "target:_blank;dependent:1;pos:100,100;size:panel;modal:1;");
oCreator.View.Arguments = arr;
oCreator.View.onClose = onClose;
Obsolete and therefore not recommended approach of modal window opening by the OpenViewModal method. If this method is used then the modal window is opened synchronously and therefore the script waits until the window is closed by the user. If the window is enabled for the Web, then problems may occure since some Web browsers do not support such approach (Chrome, Opera).