| pMe | (Object) Reference to the PmaRoot object where the event rises. |
|---|---|
| pEvent | (Object) Reference to an object describing detailed information about the specific event.
pEvent.Type - (String) [for reading] 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 window or in the PmaRoot.onAppStopBegin event. "HardStop" - Application stopping by calling the Pm.AppStop(1) method or by malfunction of internal component or licence.
This application stopping cannot be supressed by a confirmation window or in the PmaRoot.onAppStopBegin event. "Logoff" - Logging off the user logged in the Windows OS, see Pm.ShutDown(0, false).
The applications will be terminated with confirmation dialog. "HardLogoff" - Logging off the user logged in the Windows OS, 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 Windows OS, see Pm.ShutDown(1, false).
The applications will be terminated with confirmation dialog. "HardReboot" - Rebooting the computer with Windows OS, 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 Windows OS, see Pm.ShutDown(2, false).
The applications will be terminated with confirmation dialog. "HardShutdown" - Shutting down the computer with Windows OS, see Pm.ShutDown(2, true).
The applications will be terminated by force without any confirmation dialog (data loss may occur). pEvent.Error - (Long) [for reading] 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 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) [for reading] Enable/disable normal application stopping.
The value of this parameter is preset to true. If the value of the property is true, then the normal application stopping is enabled. If the value of the property is false, then the normal application stopping is disabled. This way it is for example possible to enable/disable normal application stopping conditionally or execute delayed application stopping, etc. |
function onTimeOut()
{
Pm.AppStop(1);
// The onAppStopBegin event is triggered with parameter pEvent.Type == "HardStop"
}
if (pEvent.Type == "Stop")
{
pEvent.Enabled = false;
pMe.Root.AddEventTimer(5000, 1, pMe.GetPathName(), onTimeOut);
pMe.Methods.SaveConfigApp();
// Designer method
}
var nSecStop = 15;
// Number of seconds until the application stops
var oPmfTimeout;
function onTimeOut()
{
if (nSecStop <= 0)
{
Pm.AppStop(1);
// The onAppStopBegin event is triggered with parameter pEvent.Type == "HardStop"
}
oPmfTimeout.Value = "Application stops in " + nSecStop + " seconds";
nSecStop--;
}
function onViewClose(ev)
{
if (ev.CloseReason == "ok")
{
nSecStop = 0;
}
else
{
pMe.Root.RemoveEventTimer("StopOut", 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, 0, "StopOut", 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();
// Designer method
}