Class MixedRealityKeyboard
Class that can launch and hide a system keyboard specifically for HoloLens 2.
Implements a workaround for UWP TouchScreenKeyboard bug which prevents UWP keyboard from showing up again after it is closed. Unity bug tracking the issue https://fogbugz.unity3d.com/default.asp?1137074_rttdnt8t1lccmtd3
Namespace: Microsoft.MixedReality.Toolkit.Experimental.UI
Assembly: cs.temp.dll.dll
Syntax
public class MixedRealityKeyboard : MonoBehaviour
Properties
CaretIndex
Returns the index of the caret within the text.
Declaration
public int CaretIndex { get; }
Property Value
Type | Description |
---|---|
Int32 |
OnCommitText
Event which triggers when commit action is invoked on the keyboard. (Usually the return key.)
Declaration
public UnityEvent OnCommitText { get; set; }
Property Value
Type | Description |
---|---|
UnityEvent |
OnHideKeyboard
Event which triggers when the keyboard is hidden.
Declaration
public UnityEvent OnHideKeyboard { get; set; }
Property Value
Type | Description |
---|---|
UnityEvent |
OnShowKeyboard
Event which triggers when the keyboard is shown.
Declaration
public UnityEvent OnShowKeyboard { get; set; }
Property Value
Type | Description |
---|---|
UnityEvent |
Text
Returns the committed text.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
String |
Visible
Returns true if the keyboard is currently open.
Declaration
public bool Visible { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
ClearKeyboardText()
Removes the current text from the keyboard.
Declaration
public virtual void ClearKeyboardText()
HideKeyboard()
Closes the keyboard for user interaction.
Declaration
public virtual void HideKeyboard()
ShowKeyboard(String, Boolean)
Opens the keyboard for user interaction.
Declaration
public virtual void ShowKeyboard(string text = "", bool multiLine = false)
Parameters
Type | Name | Description |
---|---|---|
String | text | Initial text to populate the keyboard with. |
Boolean | multiLine | True, if the return key should signal a newline rather than a commit. |
Start()
Initializes the UWP input pane.
Declaration
protected virtual void Start()
Update()
Updates the keyboard based on current keyboard state.
Declaration
protected virtual void Update()