Configuring Keyboard Shortcuts
You can define hotkeys and assign specific actions to them. At runtime, a visualization detects the keyboard input event and executes the action.
There are different locations where you can configure a keyboard input event.
The options include the following:
Configure keyboard input for a specific element.
Configure keyboard input for a specific visualization.
Configure keyboard input that is valid for all visualizations.
Select the default hotkeys.
If the visualization integrated in CODESYS is executed, then you can deactivate the keyboard input of the visualization in order to use the hotkey from CODESYS in this state.
Configuring hotkeys for elements
You can define a hotkey that triggers an action for an element. The element has to be visible and operable. For this purpose, the Properties view of the visualization editor.
property is available in theRequirement: A CODESYS project with the existing visEllipse
and visRectangle
visualizations is open.
Select the application in the device tree and add a visualization named
visMain
.The visualization editor opens.
In the Visualization ToolBox view, select and drag the Frame element to the editor.
The Configuration of Frame Visualizations dialog opens.
Double-click in succession the
visEllipse
andvisRectangle
visualizations in Available Visualizations.The visualizations appear in Selected Visualizations.
Click OK to exit the dialog.
The visualization contains a new element type Frame. The 2 selected visualizations appear under its property References.
In the editor, the frame shows the visualization with the index
0
.Add a button and configure its properties:
In the
property, enterRectangle
.In the Toggle frame visualization on the
property, selectvisRectangle
visualization.In the
property, specify the valueR
.The button has a user input and a hotkey.
Add a button and configure its properties:
In the
property, enter aEllipse
.In the Toggle frame visualization on the
property, selectvisEllipse
visualization.In the
property, specify the valueE
.The button has a user input and a hotkey.
Click
for the device and start the application.The visualization starts. It has a frame where one of the referenced visualizations runs. Focus on the
visEllipse
visualization and press E. The visualization switches the contents in the frame to thevisEllipse
visualization. When you press R, the visualization switches the contents in the frame to thevisRectangle
visualization.
Configuring hotkeys for a specific visualization
You can define hotkeys that trigger an input action on a specific visualization. The Keyboard Configuration tab in the editor of the visualization is used for this purpose.
Requirement: A CODESYS project with the visEllipse
and visRectangle
visualizations is open.
Open the CODESYS TargetVisu object and select
visEllipse
as the start visualization.Open the
visEllipse
visualization and click the Keyboard Configuration tab.Click
.The Keyboard Configuration tab opens.
Select the value
C
in the Key column.Activate the Press key option.
Select the Change shown visualization value in the Action Type column.
Select
visRectangle
in the Action column.The user input is configured for C.
Open the
visRectangle
visualization and click the Keyboard Configuration tab.Select the value
C
in the Key column.Activate the Press key option.
Select the Change shown visualization value in the Action Type column.
Select
visEllipse
in the Action column.The user input for C is also configured for this visualization.
Build the application.
Click
for the device and start the application.The visualization starts and displays an ellipse. Focus on the
visEllipse
visualization and press C. ThevisRectangle
visualization is displayed. Focus on the visualization and press C again. Now the visualization is switched again tovisRectangle
.
Configuring hotkeys for all visualizations in the application
You can define hotkeys that trigger the same input action for all visualizations of the application. The Default Hotkeys tab in the Visualization Manager is available for this purpose.
Requirement: A project with a visualization is open.
Open the visualization.
Add a rectangle.
Configure its
property withHotkey
.Double-click the GlobalTextList object.
Click in the table, Add Language, and then specify
de
.The language
de
is configured.Click in the table, Add Language, and then specify
en
.The language
en
is configured.Configure translations for
de
anden
for the textHotkey
.Hotkey Keyboard Shortcut Hotkey
Open the Visualization Manager and select the Default Hotkeys tab.
Specify
D
in the Key column.Activate the Press key option.
Select the Change language value in the Action Type column.
Select the language
de
in the Action column.The keyboard event for D is configured.
Specify
D
in the Key column.Activate the Press key option.
Select the Alt option.
Select the Change language value in the Action Type column.
Select the language
en
in the Action column.The keyboard event for Alt+D is configured.
Compile, download, and start the application.
The visualization opens.
As the visualization user, press D.
The text is displayed in the language
de
.
Activating standard keyboard handling
When you activate the universal hotkeys for standard keyboard handling, the user can operate the visualization without a mouse. Elements that respond to user input can process a keyboard event instead of a mouse event without adapting its input configuration.
Requirement: A project with a visualization is open.
Click the Visualization Manager object.
Activate the Activate standard keyboard handling option.
The universal hotkeys are activated.
Download the application to a device and start the application.
The visualization starts. Now operation can proceed without the mouse. You can navigate in the window by means of the Arrow and Tab keys and press Enter instead of the mouse button.
Activating and deactivating hotkeys for integrated visualizations
When you execute the visualization as an integrated visualization, the CODESYS.
command is available in order to deactivate the capturing of keyboard events. It is actually possible for the same keyboard shortcuts to be defined in the visualization and inWhen you activate the command, the visualization executes the configured keyboard events.
When you deactivate the command, CODESYS executes the keyboard events. Capturing keyboard events is then deactivated for the visualization.