SendKeyObject

Sends key event codes to objects in the currently displayed project screen. You can use this function to trigger Command animations on these objects.

Function Group Execution Windows Embedded Thin Client
SendKeyObject Module Activity Synchronous Supported Not supported Not supported
Note: This function cannot be used with Tasks or in the Global Procedures script.

Syntax

SendKeyObject( numEvent, strMainKey, numShift, numCtrl, numAlt, strTargetScreen, optNumID )
numEvent
The event code for "On Down", "On While" or "On Up" of the Command animation, as follows:
0 On Down
1 While Down
2 On Up
Note: The "On While" event requires special attention. Each time the SendKeyObject() function is executed, IWS executes the expressions configured for the "On While" sheet (from the object's Command animation) just once.
strMainKey
The key to be sent to the screen. The following values are accepted:
  • "F1" … "F20"
  • "+ "
  • "-"
  • "/"
  • "*"
  • "HOME"
  • "END"
  • "INSERT"
  • "DELETE"
  • "DOWN"
  • "UP"
  • "LEFT"
  • "RIGHT"
  • "PAGEUP"
  • "PAGEDOWN"
  • "SPACE"
  • "RETURN"
  • "BACKSPACE"
  • "ESCAPE"
  • "A" … "Z"
numShift
A numeric value or tag; whether to include Shift with the key (0 is no, 1 is yes).
numCtrl
A numeric value or tag; whether to include Ctrl with the key (0 is no, 1 is yes).
numAlt
A numeric value or tag; whether to include Alt with the key (0 is no, 1 is yes).
strTargetScreen
The name of the screen to receive the key event code.
Note: The numShift, numCtrl, numAlt and strTargetScreen parameters are optional. However, if you configure one of them, then you must configure the others as well.
optNumID
The specific instance number of the screen. (The ID is assigned when the screen is opened with the Open() function.) This is an optional parameter; the default ID is 0.

Returned value

This function returns no values.

Examples

Tag Name Expression
  SendKeyObject( 0, "R", 1, 0, 0, "main", 10 ) // Sends Shift-R to the "main" screen with ID 10.