![Jetter JVM-507B - HMI User Manual Download Page 69](http://html2.mh-extra.com/html/jetter/jvm-507b-hmi/jvm-507b-hmi_user-manual_3864918069.webp)
Jetter AG
69
JVM-507B
Initial commissioning
The functions
OnKeyDown
and
OnKeyUp
let you trigger, for example,
visualization commands when a key is pressed or released. The operating
system transfers a specific key code to the function depending on what key
you press.
For example, the following key codes are assigned to the keys
[F1]
through
[F4]
:
Key
Key code
Constant
F1
0x70
KEY_F1
F2
0x71
KEY_F2
F3
0x72
KEY_F3
F4
0x73
KEY_F4
The file
VISU_Defines.stxp
holds the key codes assigned to individual keys
as constants. This lets you use constants in the application program.
A sample STX program is listed below:
#include
"VisualInterface.stxp"
Function
OnKeyDown(KeyCode:LONG, Flags:Long)
Case
KeyCode
Of
KEY_F1
: VisuCmdAttribute(Ellipse_4000,
ELLIPSE_ATTR_FILLATTRIBUTE, FillAttribute_26000);
Break
;
KEY_F2
: VisuCmdAttribute(Ellipse_4000,
ELLIPSE_ATTR_FILLATTRIBUTE, FillAttribute_26001);
Break
;
KEY_F3
: VisuCmdAttribute(Ellipse_4000,
ELLIPSE_ATTR_FILLATTRIBUTE, FillAttribute_26002);
Break
;
KEY_F4
: VisuCmdAttribute(Ellipse_4000,
ELLIPSE_ATTR_FILLATTRIBUTE, FillAttribute_26003);
Break
;
End_Case
;
End_Function
;
It is advisable to use for
Ellipse_4000
and
FillAttribute_26000
object names
in JetViewSoft that are more descriptive. This makes it easier to find these
objects and to assign them properly. Instead of
FillAttribute_26000
you could
name it, for example,
FillAttribute_White
.
Blanks or special characters (ä, ö, ü, ß, -, ...) are not allowed for object names.
JetViewSoft lets you enter object names in the properties pane of the
corresponding object. JetViewSoft incorporates this object name and the
object ID into the file
VisualInterface.stxp
. Then, you can use the object
name and ID in the program.
Functions
OnKeyDown
and
OnKeyUp
Recommendations