Date: Fri, 29 Mar 2024 09:10:58 +0000 (UTC) Message-ID: <2001515210.133.1711703458303@6bf000190eb4> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_132_534415609.1711703458302" ------=_Part_132_534415609.1711703458302 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
A "Visualization Manger" is added to the =
project automatically.
Add the library "VisuElemBase" as a top-level library in the "Library Mana=
ger".
The method "HandleKeyEvent" is created au=
tomatically with the FB:
Declaration
FUNCTIO= N_BLOCK EventHandler IMPLEMENTS IKeyEventHandler VAR_INPUT END_VAR VAR_OUTPUT udiKeyDownCount : UDINT; END_VAR VAR END_VAR
Declaration
{warnin= g 'add method implementation '} (* This method will be called after a key event is released.=20 RETURN:=20 TRUE - When the handler has handled this event and it should not be handle= d by someone else FALSE - When the event is not handled by this handler*) METHOD HandleKeyEvent : BOOL VAR_INPUT (* The event type. The value is true if a key up event was released.*) bKeyUpEvent : BOOL; (* The key code*) dwKey : DWORD; (* The modifiers. Possible values are: VISU_KEYMOD_SHIFT : DWORD :=3D 1; VISU_KEYMOD_ALT : DWORD :=3D 2; VISU_KEYMOD_CTRL : DWORD :=3D 4;*) dwModifiers : DWORD; (* A pointer to the client structure were tje event was released*) pClient : POINTER TO VisuStructClientData; END_VAR
Implementation
IF bKey= UpEvent THEN THIS^.udiKeyDownCount :=3D THIS^.udiKeyDownCount + 1; =20 END_IF
Declaration
PROGRAM= PLC_PRG VAR instEvHandler : EventHandler; udiCurValue : UDINT; END_VAR
Implementation
udiCurV= alue :=3D instEvHandler.udiKeyDownCount;
Versions < V3.5.SP10
In old versions, the following approach is not possible, because the ass=
ignment of a program from the visualization manager was not possible:
For these versions, an initialization must take place in the program code.=
Declaration
PROGRAM= VisuInit VAR END_VAR
Implementation
VisuEle= ms.VisuElemBase.g_VisuEventManager.SetKeyEventHandler(PLC_PRG.instEvHandler= );