NativeUIModule

The NativeUI module exposes editable text.

Example

//==============================================================================
// The following example demonstrates how to get and set the value of editable
// text through scripting and keyboard input.
//
// Project setup:
// - Insert text
// - Set the text to 'Editable' in the inspector
// - Add the 'Editable text' capability under 'Native UI Control'
// - Add the 'Tap Gesture' capability under 'Touch Gestures'
//==============================================================================

// Load in the required modules
const Diagnostics = require('Diagnostics');
const NativeUI = require('NativeUI');
const TouchGestures = require('TouchGestures');

// Set the initial text value
NativeUI.setText('text0','Default Text');

// Subscribe to tap gestures
TouchGestures.onTap().subscribe(function () {

  // Enter text editing mode
  NativeUI.enterTextEditMode('text0');

});

// Subscribe to changes in the text
NativeUI.getText('text0').monitor().subscribe(function(textUpdate){

  // Log the new text value to the console
  Diagnostics.log('You entered ' + textUpdate.newValue);

});

Properties

Methods

Classes

Last updated