Update cookies preferences
Promotic

onKeyPress - event of the PmaRoot object

Description:
The event is triggered after pressing or releasing any key.
Parameters:
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.Action - (Long) [for reading] Indication of pressing or releasing the key.
0 - releasing the key
1 - pressing the key
pEvent.Code - (Long) [for reading] Pressed key code. In case of an ANSI character the value equals the char code, for the other codes see Keys constants.
For conversion of such numeric code into String the Pm.StringCodeFrom method can be used.
pEvent.Ctrl - (Boolean) [for reading] Indication of concurrent pressing the Ctrl key.
pEvent.Shift - (Boolean) [for reading] Indication of concurrent pressing the Shift key.
pEvent.Alt - (Boolean) [for reading] Indication of concurrent pressing the Alt key.
Note:
The event has the same parameters as the PmgObject.onKeyPress event or the PmaPanel.onKeyPress event.
See also:
- PmaKey (object)
Example:
The following example is in the form that is automatically generated after creating a new application. 'Hot' keys are defined as follows:
- Ctrl-S for halting the application - Pm.AppStop
- Ctrl-I for opening the INFO system
- Ctrl-P for logging in the local user - Pm.WndLogon
- Ctrl-O for logging out the local user - Pm.WndLogoff
- Ctrl-G for opening the window with the list of panels
- Ctrl-A for opening the window of alarm groups
- Ctrl-E for opening the window with event groups
JavaScriptSelect and copy to clipboard

var oCreator;
var sTarget;
function onViewClose(ev)
{
if (ev.CloseReason == "ok")
{
var sViewer = ev.ReturnValue;
if (Pm.IsValid(sViewer))
{
Pm.CreateView(Pm.GetActiveWorkspace(), sViewer, "", sTarget).Open();
}
}
}


if (pEvent.Action == 0 && pEvent.Ctrl && ! pEvent.Shift && ! pEvent.Alt)
{
switch (pEvent.Code)
{
case 83:   // Key S
Pm.AppStop();
break;
case 73:   // Key I
Pm.CreateView(Pm.GetActiveWorkspace(), "/#glob/infosystem", "", "target:_blank;").Open();
break;
case 80:   // Key P
Pm.WndLogon(true);
break;
case 79:   // Key O
Pm.WndLogoff(true);
break;
case 71:   // Key G
sTarget = "target:main;";
oCreator = Pm.CreateView(Pm.GetActiveWorkspace(), "/#glob/list", "autoselect:1", "target:_blank;modal:1;size:300,350;");
oCreator.View.list = Pm.FindViewers("groups:menu;viewers:panel;", "", "headers:;columns:path,title;");
oCreator.View.title = Pm.EvalMacro("$.text('sys','panelsName')");
oCreator.View.onClose = onViewClose;
oCreator.Open();
break;
case 65:   // Key A
sTarget = "target:_blank.alarms;size:1000,500;";
oCreator = Pm.CreateView(Pm.GetActiveWorkspace(), "/#glob/list", "autoselect:1", "target:_blank;modal:1;");
oCreator.View.list = Pm.FindViewers("groups:menu;viewers:alarm_state;", "", "columns:path,title,alstate3,alstate2,alstate1,alhoot;");
oCreator.View.title = Pm.EvalMacro("$.text('sys','alarmsName')");
oCreator.View.onClose = onViewClose;
oCreator.Open();
break;
case 69:   // Key E
sTarget = "target:_blank.events;size:1000,500;";
oCreator = Pm.CreateView(Pm.GetActiveWorkspace(), "/#glob/list", "autoselect:1", "target:_blank;modal:1;");
oCreator.View.list = Pm.FindViewers("groups:menu;viewers:event;", "", "columns:path,title;");
oCreator.View.title = Pm.EvalMacro("$.text('sys','eventsName')");
oCreator.View.onClose = onViewClose;
oCreator.Open();
break;
}
}
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.