KEY

Concept Link IconSee also

Program the keyboard function keys on the desktop client.

WebVue support - Not applicable. Returns an unsuccessful code if used in this context.

Mode Mnemonic Syntax
1 ADDCLK 1
2 ADDSTD 2
3 ADDPROG 3
5 DEL 4
6 DELALL 5
11 ADDCLKS 1
12 ADDSTDS 2
13 ADDPROGS 3
21 DELSTD 6
22 DELCLK 7
23 DELPROG 8

Changes in function key management from version 12 onwards

Prior to version 12 the default configuration of the function keys with pre-configured standard actions was created automatically each time the software PcVue started. Any changes made as part of the project configuration were overwritten. This meant that if you wanted to delete or change the function of any of these keys permanently, it had to be done using a SCADA Basic program arranged to run each time the software PcVue was started.

From version 12 onwards, the default configuration of the function keys with pre-configured standard actions is created once only when the project is first created. Therefore, any changes made subsequently as part of the project configuration are permanent.

If you start a project created with a version prior to 12, the behavior is the same as if you were creating a new project. That is the default configuration of the function keys with pre-configured standard actions is created once only. Once you have customized the configuration of function keys using the Application Explorer, the SCADA Basic program to delete or change the function of these keys is no longer necessary and can be removed from the project.

Arguments common to more than one mode

Argument

Meaning

Modifiers

Description of the modifiers - See below for the list of possible values. Type STR.

KeyCode

Code of the key - See below for the list of possible values. Type INTEGER.

Activbit

Optional. The name of a bit or alarm variable which enables the event. Type STR.

ActiveConditionTo1

Optional. The state to which the ActivBit must be set to enable the event. Either 0 or 1. The default is 1.

DellAllMode

Optional argument to indicate which keys should be deleted, temporary created by program and/or permanent keys created by configuration. Type: INTEGER.

1 = Delete temporary keys only (default value),
2 = Delete permanent keys only,
3 = Delete both temporary and permanent keys.

Syntax 1

IntVal = KEY(Mode, Modifiers, KeyCode, Window, Branch, Identity[, Activbit[, ActiveConditionTo1]]);

Return type: INTEGER

Argument

Meaning

Window

The name of the window where the control zone is. Type STR.

Branch

The name of the branch of the window where the control zone is. Type STR.

Identity

The Id of the animation (control zone) in the specified window. Type STR.

Execution

Mode

Mnemonic

Action

1

ADDCLK

Program a function key to operate a control zone on a window. Replace the previous ADDCLK on the same key combination (Modifiers+KeyCode)

11

ADDCLKS

Add another function to a key, without deleting any previous functions.

 

 

Return: 1 if successful, else 0.

Syntax 2

IntVal = KEY(Mode, Modifiers, KeyCode, Action[, Activbit[, ActiveConditionTo1]]);

Return type: INTEGER.

Argument

Meaning

Action

Id of a standard function - See below for the list of possible values. Type INTEGER.

Execution

Mode

Mnemonic

Action

2

ADDSTD

Program a standard action. Cancel and replace the previous control on the same key.

12

ADDSTDS

Add another function to a key, without deleting any previous functions.

    Return: 1 if successful, else 0.

Syntax 3

IntVal = KEY(Mode, Modifiers, KeyCode, Program, Branch, Function[, farg[, Activbit[, ActiveConditionTo1]]]);

Return type: INTEGER.

Argument

Meaning

Program

The name of the program where the function is. Type STR.

Branch

The name of the branch. Type STR.

Function

The name of the function. Type STR.

Farg

Optional. String of 2,047 characters maximum. Used to pass from 1 to 8 arguments (separated by a comma) to the function. Type STR.

Execution

Mode

Mnemonic

Action

3

ADDPROG

Execute a function from a program.

If the name of the function is not given then the MAIN routine will run.

13

ADDPROGS

Add another function to a key, without deleting any previous functions.

    Return: 1 if successful, else 0.

Syntax 4

IntVal = KEY( Mode, Modifiers, KeyCode, DelAllMode]);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

5

DEL

Remove all actions for the specified key.

Return: 1 if successful, else 0.

Syntax 5

IntVal = KEY(Mode, DelAllMode]) ;

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

6

DELALL

Remove all actions for all keys.

Return: 1 if successful, else 0.

Syntax 6

IntVal = KEY(Mode, Modifiers, KeyCode, Window, Branch, Identity);

Return type: INTEGER.

Argument

Meaning

Window

The name of the window where the control zone is. Type STR.

Branch

The name of the branch of the window where the control zone is. Type STR.

Identity

The Id of the animation (control zone) in the specified window. Type STR.

Execution

Mode

Mnemonic

Action

21

DELCLK

Remove control specified by the key of the control zone.

Return: 1 if successful, else 0.

Syntax 7

IntVal = KEY(Mode, Modifiers, KeyCode, Action);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

22

DELSTD

Remove the action specified.

Return: 1 if successful, else 0.

Syntax 8

IntVal = KEY(Mode, Modifiers, KeyCode, Program, Branch, Function);

Return type: INTEGER.

Argument

Meaning

Program

The name of the program where the function is.

Branch

The name of the branch given as an argument to the function when called.

Function

The name of the function.

Execution

Mode

Mnemonic

Action

23

DELPROG

Remove the specified action.

Return: 1 if successful, else 0.

To call a function, the program must be pre-loaded.

If the MAIN function is used, then the instruction DELAY must not be used or the behavior is undefined.

Possible values for the Modifiers argument

The parameter Modifiers is a string describing the key handling modifiers.

Value

Behavior

D

The action is executed when the key is pressed (otherwise releasing the key executes the action).

S

The action is executed when the key and the Shift key are pressed together.

C

The action is executed when the key and the Ctrl key are pressed together.

A The action is executed when the key and the Alt key are pressed together.

Characters may be combined, for example, SC would mean pressing the control and shift key together.

Possible values for the KeyCode argument

The parameter KeyCode is an integer representing a keyboard key.

Key

Key Code

F1

1

F2

2

F3

3

F4

4

F5

5

F6

6

F7

7

F8

8

F9

9

F10

10

F11

11

F12

12

F13

13

F14

14

F15

15

F16

16

Back space

17

Tab

18 Do not use.

Enter

19 Do not use.

Shift

20 Do not use other than as a modifier.

Ctrl

21 Do not use other than as a modifier.

Alt

22 Do not use other than as a modifier.

Pause

23 Do not use.

Esc

24

Space

25 Do not use.

Page up

26

Page down

27

End

28

Home

29

Left arrow

30

Up arrow

31

Right arrow

32

Down arrow

33

Print

34 Do not use.

Insert

35

Delete

36

Numlock

37 Do not use.

Possible values for the Action argument

The parameter Action is an integer representing the Id of a standard action.

Id

Corresponding standard action

1 Online help
2 Logon / logoff
3 User accounts
4 About window
6 Show menu
7 Display event viewer
8 Hide menu
9 Programs
10 Quit application
11 Data exports
12 VCR
19 Command zone
21 Next window
22 Previous window
23 Next zone
24 Previous zone
25 First zone
26 Last zone
121 Variable selector
122 Refresh screen
124 Central project management

Example

KEY(2,"D" ,2, 2); ' F2
KEY(2,"D" ,3, 3); ' F3
KEY(2,"D" ,4, 4); ' F4
KEY(2,"D" ,5, 5); ' F5
KEY(2,"D" ,6, 6); ' F6
KEY(2,"D" ,7, 7); ' F7
KEY(2,"D" ,8, 8); ' F8
KEY(2,"D" ,9, 9); ' F9
KEY(2,"DS",10, 10); ' F10
KEY(2,"D" ,11, 11); ' F11
KEY(2,"" ,27, 21); ' PageDn
KEY(2,"" ,26, 22); ' PageUp
KEY(2,"" ,32, 23); ' ArrowRt
KEY(2,"" ,33, 23); ' ArrowDn
KEY(2,"" ,30, 24); ' ArrowLt
KEY(2,"" ,31, 24); ' ArrowUp
KEY(2,"" ,29, 25); ' Home
KEY(2,"" ,28, 26); ' End