Device.setTouchable()

Overview

Sets whether Velocity responds to device screen touch events. When set to false, the app and its context and main menus will not respond.

Setting this to false disables touch-based gestures in Velocity. Gestures such as swiping up or down on a web page, for instance scrolling or dragging and zooming via touch are not responded to. However, system navigation buttons and gestures are still enabled.

Added in version 2.1.43

Android only

Format

Device.setTouchable(touchable);

Parameter Description Type Required
touchable Flag that allows handling touch events. Use false to not respond to events or true to handle them. Number Required

Example 1

Copy
/* Don't respond to hardware touch events.
 */
Device.setTouchable(false);

Example 2

Copy
/* Don't respond to hardware touch events when the device
hardware key F8 has been pressed.
 */
function SetDeviceTouchable(event) {
  Device.setTouchable(false);
}

WLEvent.on("OnKey<E042>", SetDeviceTouchable);

Example 3

Copy
/* Don't respond to hardware touch events when the device
hardware key F7 has been pressed.
 */
function DisableDeviceTouchable(event) {
  Device.setTouchable(false);
}

/* Enable handling events when F8 has been pressed
 */
function EnableDeviceTouchable(event) {
  Device.setTouchable(true);
}

WLEvent.on("OnKey<E041>", DisableDeviceTouchable);
WLEvent.on("OnKey<E042>", EnableDeviceTouchable);