Using Touch Screen Mode
Using Touchscreen Mode
Watch the videoIt is very common to deploy Ignition Vision projects on touchscreen computers, such as industrial panel-PCs acting as Human Machine Interface (HMI) or Operator Interface Terminal (OIT). In situations where the PC does not have a keyboard attached, Touch Screen Mode can be used to assist with user-input. For this reason, all of the input components in Vision are touch-screen-enabled.
Under normal circumstances, you don't have to do anything special other than enable Touch Screen Mode on your project. This will allow the operator to activate Touch Screen Mode when they log in. You can also enable Touch Screen Mode via scripting.
Touch-screen-enabled input components all have an expert level property called Touch Screen Mode. This property has three settings:
- Single-Click: The keyboard will appear on a single click.
- Double-Click: They keyboard will only appear after a double-click.
- None: Disable touch screen support on the component. The component will no longer invoke the touch screen keyboard.
Enabling Touch Screen Mode
Touch Screen support is built into Ignition. Turn it on through the Project Properties or scripting.
In the Designer, from Project Browser, double-click on Project > Properties, or from the top menus go to Project > Properties. The Project Properties window is displayed.
Go to Client > General page, to see the Touch Screen options.
Property Description Touch Screen Mode Enabled By default, this is enabled, which means an operator can activate the mode on the startup screen. All Clients can operate in touch screen mode. When Touch Screen mode is enabled, clicking on numeric and text entry boxes will pop up on-screen keyboards that can be used for data entry. You can optionally set the width of any scrollbars (number of pixels wide/tall). Touch Screen Mode Active on Startup This option sets the Clients to start up with the touch-screen mode active.
These settings are helpful for mixed-use projects, that is, those that are launched on both touch screen devices and traditional computers and laptops.
Invoke the Touch Screen Keyboard with Scripting
To handle touch screen logic via scripting, the general pattern is to respond to a mouse event, popup up a keyboard, and then set the component's value to whatever was entered in the keyboard. For example, for a text field, you would write a script like this:
if system.gui.isTouchscreenModeEnabled():
currentText = event.source.text
newText = system.gui.showTouchscreenKeyboard(currentText)
See also: system.gui.setTouchscreenModeEnabled