pMe | (Object) Reference to the PmaRoot object where the event rises. |
---|---|
pEvent | (Object) Reference to object describing detailed information about the specific event. pEvent.Type - (String) Application stopping type. "Stop" - Normal application stopping called by the Pm.AppStop(0) method or by closing the main application window. This normal application stopping can still be supressed by the confirmation dialog or in the PmaRoot.onAppStopBegin event. "HardStop" - Stopping the application by calling the Pm.AppStop(1) method or by malfunction of internal component or licence. This application stopping can not be supressed by a confirmation dialog or in the PmaRoot.onAppStopBegin event. "Logoff" - Logging off the user logged in the OS Windows, see Pm.ShutDown(0, false) The applications will be terminated with confirmation dialog. "HardLogoff" - Logging off the user logged in the OS Windows, see Pm.ShutDown(0, true) The applications will be terminated by force without any confirmation dialog (data loss may occur). "Reboot" - Rebooting the computer with OS Windows, see Pm.ShutDown(1, false) The applications will be terminated with confirmation dialog. "HardReboot" - Rebooting the computer with OS Windows, see Pm.ShutDown(1, true) The applications will be terminated by force without any confirmation dialog (data loss may occur). "Shutdown" - Shutting down the computer with OS Windows, see Pm.ShutDown(2, false) The applications will be terminated with confirmation dialog. "HardShutdown" - Shutting down the computer with OS Windows, see Pm.ShutDown(2, true) The applications will be terminated by force without any confirmation dialog (data loss may occur). pEvent.Error - (Long) If the value of the parameter is 0, then the application is stopped by the user (designer) command - i.e. by calling the Pm.AppStop or Pm.AppQuit method. Otherwise (the value is no-zero), the application is stopped from the failure cause of some component (e.g. ActiveX object, etc.). pEvent.Enabled - (Boolean) Enable/disable normal application termination. The value of this parameter is preset to true. If the value of the property is true, then the normal application termination is enabled. If the value of the property is false, then the normal application termination is disabled. This way it is for example possible to enable/disable normal application termination conditionally or execute delayed termination, etc. |
function onTimeOut()
{
Pm.AppStop(1); //will by called "onAppStopBegin" with pEvent.Type == "HardStop"
}
if (pEvent.Type == "Stop")
{
pEvent.Enabled = false;
pMe.Root.AddEventTimer(5000, 1, onTimeOut);
pMe.Methods.SaveConfigApp(); //user method
}
var nSecStop = 15; //number of seconds until the application stops
var oPmfTimeout;
function onTimeOut()
{
if (nSecStop <= 0)
Pm.AppStop(1); //will by called "onAppStopBegin" with pEvent.Type == "HardStop"
oPmfTimeout.Value = "Application stops in " + nSecStop + " seconds";
nSecStop--;
}
function onViewClose(ev)
{
if (ev.CloseReason == "ok")
nSecStop = 0;
else
pMe.Root.RemoveEventTimer(onTimeOut, 0);
}
function onViewLoad(ev)
{
var oForm = ev.Form;
oForm.Title = "Application stop";
oForm.CreateItem("separ", "separ", "", "Subtype:space;TitlePos:no;BodyHeightIni:1;");
oPmfTimeout = oForm.CreateItem("string", "msg", "", "Subtype:static;TitlePos:no;Multiline:1;ValueHorzAlign:center;");
oPmfTimeout.Value = "Application stops in " + nSecStop + " seconds";
}
if (pEvent.Type == "Stop")
{
pEvent.Enabled = false;
pMe.Root.AddEventTimer(1000, -1, onTimeOut);
var oCreator = Pm.CreateView(pMe.PmPanel, "/#glob/form", "", "target:_blank;modal:1;");
oCreator.View.onLoad = onViewLoad;
oCreator.View.onClose = onViewClose;
oCreator.Open();
pMe.Methods.SaveConfigApp(); //user method
}