Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onKeyPress - event of object PmRoot

Description:
The event fires on pressing or releasing any key.
Parameters:
pMe(Object) Reference to the PROMOTIC object where the event rises.
pEvent(Object) A referrence to object describing detailed information about the specific event.
pEvent.Action - (Integer) Indication of pressing or releasing the key.
0 - key release
1 - key press
pEvent.Code - (Long) Pressed key code. In case of an ANSI character the value equals the char code, for the other codes see Keys constants.

In order to convert such numeric code into String the Pm.StringCodeFrom method can be used.

pEvent.Ctrl - (Boolean) Indication of concurrent pressing the Ctrl key.
pEvent.Shift - (Boolean) Indication of concurrent pressing the Shift key.
pEvent.Alt - (Boolean) Indication of concurrent pressing the Alt key.
Note:
The event has the same parameters as the PmiItem.onKeyPress or PmPanel.onKeyPress event.
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 calling 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 calling the list with panels
- Ctrl-A for calling the window with alarm groups
- Ctrl-E for calling the window with event groups
VBScriptSelect and copy to clipboard

Dim aList, sViewer
If pEvent.Action = 0 And pEvent.Ctrl And Not pEvent.Shift And Not pEvent.Alt Then
  Select Case pEvent.Code
  Case 83
    Pm.AppStop
    'Key S
  Case 73
    Pm.GetActiveWorkspace().OpenView "/#glob/infosystem", "target:_blank;"
    'Key I
  Case 80
    Pm.WndLogon true
    'Key P
  Case 79
    Pm.WndLogoff true
    'Key O
  Case 71
    aList = Pm.FindViewers("groups:menu;viewers:panel;", "", "columns:path,title;")
    sViewer = Pm.SelectionDialog(aList, "", "$.text('sys','panelsName'", "size:300,350;autoselect:1;")
    If Pm.IsValid(sViewer) Then  'Key G
      Pm.GetActiveWorkspace().OpenView sViewer, "target:main;", ""
    End If
    'Key G
  Case 65
    aList = Pm.FindViewers("groups:menu;viewers:alarm_state;", "", "columns:path,title,alstate3,alstate2,alstate1,alhoot;")
    sViewer = Pm.SelectionDialog(aList, "", "$.text('sys','alarmsName'", "size:500,350;autoselect:1;")
    If Pm.IsValid(sViewer) Then  'Key A
      Pm.GetActiveWorkspace().OpenView sViewer, "target:main;", ""
    End If
    'Key A
  Case 69
    aList = Pm.FindViewers("groups:menu;viewers:event;", "", "columns:path,title;")
    sViewer = Pm.SelectionDialog(aList, "", "$.text('sys','eventsName'", "size:500,350;autoselect:1;")
    If Pm.IsValid(sViewer) Then  'Key E
      Pm.GetActiveWorkspace().OpenView sViewer, "target:main;", ""
    End If
    'Key E
  End Select
End If
PROMOTIC 8.3.27 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