class MAGES::UIs::InputAndFieldSwap

Overview

Input And Field Swap Description: Use with the VRKeyboard in order to select from multiple input fields and edit them with the keyboard. Use Instructions: 1) Attach this script to the keyboard or anywhere else and pass the reference to the keyboard. 2) Attach TabCallbackReceiver() and TextKeyCallbackReceiver() in the VRKeyboard’s OnTab and OnAnyTextKey Events accordingly. 3) Attach references in the list of fields for every field. (Keep the order shown on screen in order for the tab to work correctly). 4) Set the default selection (the position of the field in the list) if any, or leave to -1 for no selected field at startup. 5) From every field attach the SetSelected(int. <the position of this field in the list>) as a Callback function on click. 6) Attach on every field the VRKeyHighlightAndHaptic.cs script if you want this script to take care of selection transitions, like color changes or sprite swaps (Optional). 7) Enjoy! More…

class InputAndFieldSwap: public MonoBehaviour
{
public:
    // properties

    VRKeyboardController Keyboard;
    List Fields;
    int Selected;

    // methods

    void SetSelected(int selection);
    void DeselectAll();
    void TabCallbackReceiver();
    void TextKeyCallbackReceiver();
};

Detailed Documentation

Input And Field Swap Description: Use with the VRKeyboard in order to select from multiple input fields and edit them with the keyboard. Use Instructions: 1) Attach this script to the keyboard or anywhere else and pass the reference to the keyboard. 2) Attach TabCallbackReceiver() and TextKeyCallbackReceiver() in the VRKeyboard’s OnTab and OnAnyTextKey Events accordingly. 3) Attach references in the list of fields for every field. (Keep the order shown on screen in order for the tab to work correctly). 4) Set the default selection (the position of the field in the list) if any, or leave to -1 for no selected field at startup. 5) From every field attach the SetSelected(int. <the position of this field in the list>) as a Callback function on click. 6) Attach on every field the VRKeyHighlightAndHaptic.cs script if you want this script to take care of selection transitions, like color changes or sprite swaps (Optional). 7) Enjoy!

Properties

VRKeyboardController Keyboard

Gets or Sets the keyboard that spawns as soon as the user activates an input field.

List Fields

Gets or Sets the list of the available input fields.

int Selected

Gets or Sets the index of the selected input field (in case none is selected the value is -1).

Methods

void SetSelected(int selection)

Sets the activated input field according to an index.

Parameters:

selection

The index corresponding to a specific field inside the fields list.

void DeselectAll()

Deselects all fields inside the fields list.

void TabCallbackReceiver()

Callback function in case the Tab key is pressed.

void TextKeyCallbackReceiver()

Callback function in case an ordinary text key is pressed.