Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Example: Creates PmForm window configured as MessageBox

In a single script (e.g. after pressing the button in the onButtonUp event) a user defined MessageBox is created, that may contain some of the buttons ok,cancel,yes,no. The Debug method in the switch command can be replaced by any other command.
JavaScriptSelect and copy to clipboard

function onViewLoad(ev)
{
//Creates a form object
var oForm = ev.Form;
oForm.Title = "MessageBox";

//oForm.SysLayoutPos = "bottom";
oForm.SysButtons = "ok,cancel";  //ok,cancel,yes,no

oForm.CreateItem("separ", "separ", "", "Subtype:space;TitlePos:no;BodyHeightIni:1;");

var oMsg = oForm.CreateItem("string", "msg", "", "Subtype:static;TitlePos:no;Multiline:1;ValueHorzAlign:center;");
oMsg.Value = "text for massage \n YES/NO/OK/CANCEL";  //"\n" = new row

//AddEvent
oForm.AddEvent("onClose", onViewClose);
}


function onViewClose(ev)
{
switch (ev.CloseReason)
{
case "ok":
Pm.Debug("ok");
break;
case "cancel":
Pm.Debug("cancel");
break;
case "yes":
Pm.Debug("yes");
break;
case "no":
Pm.Debug("no");
break;
}
}

//Creates PmViewCreator - This object allows opening the various viewers
var oCreator = Pm.CreateView(pMe.PmPanel, "/#glob/form", "", "target:_blank;modal:1;");
oCreator.View.onLoad = onViewLoad;

//Opens form in modal window:
oCreator.Open();
PROMOTIC 9.0.13 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