Class NonNativeKeyboard
A simple general use keyboard that is ideal for AR/VR applications that do not provide a native keyboard.
Implements
Namespace: Microsoft.MixedReality.Toolkit.Experimental.UI
Assembly: cs.temp.dll.dll
Syntax
public class NonNativeKeyboard : InputSystemGlobalHandlerListener, IMixedRealityDictationHandler, InputSystemGlobalHandlerListener
Fields
AlphaKeyboard
The panel that contains the alpha keys.
Declaration
public Image AlphaKeyboard
Field Value
Type | Description |
---|---|
Image |
AlphaKeyboard
The panel that contains the alpha keys.
Declaration
public Image AlphaKeyboard
Field Value
Type | Description |
---|---|
Image |
AlphaMailKeys
References @ bottom panel.
Declaration
public Image AlphaMailKeys
Field Value
Type | Description |
---|---|
Image |
AlphaMailKeys
References @ bottom panel.
Declaration
public Image AlphaMailKeys
Field Value
Type | Description |
---|---|
Image |
AlphaSubKeys
References abc bottom panel.
Declaration
public Image AlphaSubKeys
Field Value
Type | Description |
---|---|
Image |
AlphaSubKeys
References abc bottom panel.
Declaration
public Image AlphaSubKeys
Field Value
Type | Description |
---|---|
Image |
AlphaWebKeys
References .com bottom panel.
Declaration
public Image AlphaWebKeys
Field Value
Type | Description |
---|---|
Image |
AlphaWebKeys
References .com bottom panel.
Declaration
public Image AlphaWebKeys
Field Value
Type | Description |
---|---|
Image |
CloseOnInactivity
Make the keyboard disappear automatically after a timeout
Declaration
public bool CloseOnInactivity
Field Value
Type | Description |
---|---|
Boolean |
CloseOnInactivity
Make the keyboard disappear automatically after a timeout
Declaration
public bool CloseOnInactivity
Field Value
Type | Description |
---|---|
Boolean |
CloseOnInactivityTime
Inactivity time that makes the keyboard disappear automatically.
Declaration
public float CloseOnInactivityTime
Field Value
Type | Description |
---|---|
Single |
CloseOnInactivityTime
Inactivity time that makes the keyboard disappear automatically.
Declaration
public float CloseOnInactivityTime
Field Value
Type | Description |
---|---|
Single |
InputField
The InputField that the keyboard uses to show the currently edited text. If you are using the Keyboard prefab you can ignore this field as it will be already assigned.
Declaration
public TMP_InputField InputField
Field Value
Type | Description |
---|---|
TMP_InputField |
InputField
The InputField that the keyboard uses to show the currently edited text. If you are using the Keyboard prefab you can ignore this field as it will be already assigned.
Declaration
public TMP_InputField InputField
Field Value
Type | Description |
---|---|
TMP_InputField |
InputFieldSlide
Move the axis slider based on the camera forward and the keyboard plane projection.
Declaration
public AxisSlider InputFieldSlide
Field Value
Type | Description |
---|---|
AxisSlider |
InputFieldSlide
Move the axis slider based on the camera forward and the keyboard plane projection.
Declaration
public AxisSlider InputFieldSlide
Field Value
Type | Description |
---|---|
AxisSlider |
SliderEnabled
Bool for toggling the slider being enabled.
Declaration
public bool SliderEnabled
Field Value
Type | Description |
---|---|
Boolean |
SliderEnabled
Bool for toggling the slider being enabled.
Declaration
public bool SliderEnabled
Field Value
Type | Description |
---|---|
Boolean |
SubmitOnEnter
Bool to flag submitting on enter
Declaration
public bool SubmitOnEnter
Field Value
Type | Description |
---|---|
Boolean |
SubmitOnEnter
Bool to flag submitting on enter
Declaration
public bool SubmitOnEnter
Field Value
Type | Description |
---|---|
Boolean |
SymbolKeyboard
The panel that contains the number and symbol keys.
Declaration
public Image SymbolKeyboard
Field Value
Type | Description |
---|---|
Image |
SymbolKeyboard
The panel that contains the number and symbol keys.
Declaration
public Image SymbolKeyboard
Field Value
Type | Description |
---|---|
Image |
Properties
Instance
Declaration
public static NonNativeKeyboard Instance { get; }
Property Value
Type | Description |
---|---|
NonNativeKeyboard |
Instance
Declaration
public static NonNativeKeyboard Instance { get; }
Property Value
Type | Description |
---|---|
NonNativeKeyboard |
IsCapsLocked
Accessor reporting caps lock state of keyboard.
Declaration
public bool IsCapsLocked { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsCapsLocked
Accessor reporting caps lock state of keyboard.
Declaration
public bool IsCapsLocked { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsShifted
Accessor reporting shift state of keyboard.
Declaration
public bool IsShifted { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsShifted
Accessor reporting shift state of keyboard.
Declaration
public bool IsShifted { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AppendValue(KeyboardValueKey)
Primary method for typing individual characters to a text field.
Declaration
public void AppendValue(KeyboardValueKey valueKey)
Parameters
Type | Name | Description |
---|---|---|
KeyboardValueKey | valueKey | The valueKey of the pressed key. |
AppendValue(KeyboardValueKey)
Primary method for typing individual characters to a text field.
Declaration
public void AppendValue(KeyboardValueKey valueKey)
Parameters
Type | Name | Description |
---|---|---|
KeyboardValueKey | valueKey | The valueKey of the pressed key. |
Backspace()
Delete the character before the caret.
Declaration
public void Backspace()
Backspace()
Delete the character before the caret.
Declaration
public void Backspace()
CapsLock(Boolean)
Set the keyboard to a permanent shift state.
Declaration
public void CapsLock(bool newCapsLockState)
Parameters
Type | Name | Description |
---|---|---|
Boolean | newCapsLockState | Caps lock state the method is switching to |
CapsLock(Boolean)
Set the keyboard to a permanent shift state.
Declaration
public void CapsLock(bool newCapsLockState)
Parameters
Type | Name | Description |
---|---|---|
Boolean | newCapsLockState | Caps lock state the method is switching to |
Clear()
Clear the text input field.
Declaration
public void Clear()
Clear()
Clear the text input field.
Declaration
public void Clear()
Close()
Close the keyboard. (Clears all event subscriptions.)
Declaration
public void Close()
Close()
Close the keyboard. (Clears all event subscriptions.)
Declaration
public void Close()
EndDictation()
Terminate dictation mode.
Declaration
public void EndDictation()
EndDictation()
Terminate dictation mode.
Declaration
public void EndDictation()
Enter()
Fire the text entered event for objects listening to keyboard. Immediately closes keyboard.
Declaration
public void Enter()
Enter()
Fire the text entered event for objects listening to keyboard. Immediately closes keyboard.
Declaration
public void Enter()
FunctionKey(KeyboardKeyFunc)
Trigger specific keyboard functionality.
Declaration
public void FunctionKey(KeyboardKeyFunc functionKey)
Parameters
Type | Name | Description |
---|---|---|
KeyboardKeyFunc | functionKey | The functionKey of the pressed key. |
FunctionKey(KeyboardKeyFunc)
Trigger specific keyboard functionality.
Declaration
public void FunctionKey(KeyboardKeyFunc functionKey)
Parameters
Type | Name | Description |
---|---|---|
KeyboardKeyFunc | functionKey | The functionKey of the pressed key. |
MoveCaretLeft()
Move caret to the left.
Declaration
public void MoveCaretLeft()
MoveCaretLeft()
Move caret to the left.
Declaration
public void MoveCaretLeft()
MoveCaretRight()
Move caret to the right.
Declaration
public void MoveCaretRight()
MoveCaretRight()
Move caret to the right.
Declaration
public void MoveCaretRight()
Next()
Send the "next" event.
Declaration
public void Next()
Next()
Send the "next" event.
Declaration
public void Next()
OnDictationComplete(DictationEventData)
Called when dictation is completed
Declaration
public void OnDictationComplete(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationComplete(DictationEventData)
Called when dictation is completed
Declaration
public void OnDictationComplete(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationError(DictationEventData)
Called on dictation error. Not used here.
Declaration
public void OnDictationError(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationError(DictationEventData)
Called on dictation error. Not used here.
Declaration
public void OnDictationError(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationHypothesis(DictationEventData)
Called when dictation hypothesis is found. Not used here
Declaration
public void OnDictationHypothesis(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationHypothesis(DictationEventData)
Called when dictation hypothesis is found. Not used here
Declaration
public void OnDictationHypothesis(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationResult(DictationEventData)
Called when dictation result is obtained
Declaration
public void OnDictationResult(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDictationResult(DictationEventData)
Called when dictation result is obtained
Declaration
public void OnDictationResult(DictationEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
DictationEventData | eventData | Dictation event data |
OnDisable()
Called whenever the keyboard is disabled or deactivated.
Declaration
protected override void OnDisable()
OnDisable()
Called whenever the keyboard is disabled or deactivated.
Declaration
protected override void OnDisable()
PresentKeyboard()
Present the default keyboard to the camera.
Declaration
public void PresentKeyboard()
PresentKeyboard()
Present the default keyboard to the camera.
Declaration
public void PresentKeyboard()
PresentKeyboard(NonNativeKeyboard.LayoutType)
Presents a specific keyboard to the camera.
Declaration
public void PresentKeyboard(NonNativeKeyboard.LayoutType keyboardType)
Parameters
Type | Name | Description |
---|---|---|
NonNativeKeyboard.LayoutType | keyboardType | Specify the keyboard type. |
PresentKeyboard(NonNativeKeyboard.LayoutType)
Presents a specific keyboard to the camera.
Declaration
public void PresentKeyboard(NonNativeKeyboard.LayoutType keyboardType)
Parameters
Type | Name | Description |
---|---|---|
NonNativeKeyboard.LayoutType | keyboardType | Specify the keyboard type. |
PresentKeyboard(String)
Presents the default keyboard to the camera, with start text.
Declaration
public void PresentKeyboard(string startText)
Parameters
Type | Name | Description |
---|---|---|
String | startText | The initial text to show in the keyboard's input field. |
PresentKeyboard(String)
Presents the default keyboard to the camera, with start text.
Declaration
public void PresentKeyboard(string startText)
Parameters
Type | Name | Description |
---|---|---|
String | startText | The initial text to show in the keyboard's input field. |
PresentKeyboard(String, NonNativeKeyboard.LayoutType)
Presents a specific keyboard to the camera, with start text.
Declaration
public void PresentKeyboard(string startText, NonNativeKeyboard.LayoutType keyboardType)
Parameters
Type | Name | Description |
---|---|---|
String | startText | The initial text to show in the keyboard's input field. |
NonNativeKeyboard.LayoutType | keyboardType | Specify the keyboard type. |
PresentKeyboard(String, NonNativeKeyboard.LayoutType)
Presents a specific keyboard to the camera, with start text.
Declaration
public void PresentKeyboard(string startText, NonNativeKeyboard.LayoutType keyboardType)
Parameters
Type | Name | Description |
---|---|---|
String | startText | The initial text to show in the keyboard's input field. |
NonNativeKeyboard.LayoutType | keyboardType | Specify the keyboard type. |
Previous()
Send the "previous" event.
Declaration
public void Previous()
Previous()
Send the "previous" event.
Declaration
public void Previous()
RegisterHandlers()
Declaration
protected override void RegisterHandlers()
RegisterHandlers()
Declaration
protected override void RegisterHandlers()
RepositionKeyboard(Transform, BoxCollider, Single)
Function to reposition the keyboard based on target transform and collider information
Declaration
public void RepositionKeyboard(Transform objectTransform, BoxCollider aCollider = null, float verticalOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Transform | objectTransform | Transform of target object to remain relative to |
BoxCollider | aCollider | Optional collider information for offset placement |
Single | verticalOffset | Optional vertical offset from the target |
RepositionKeyboard(Transform, BoxCollider, Single)
Function to reposition the keyboard based on target transform and collider information
Declaration
public void RepositionKeyboard(Transform objectTransform, BoxCollider aCollider = null, float verticalOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Transform | objectTransform | Transform of target object to remain relative to |
BoxCollider | aCollider | Optional collider information for offset placement |
Single | verticalOffset | Optional vertical offset from the target |
RepositionKeyboard(Vector3, Single)
Function to reposition the Keyboard based on target position and vertical offset
Declaration
public void RepositionKeyboard(Vector3 kbPos, float verticalOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | kbPos | World position for keyboard |
Single | verticalOffset | Optional vertical offset of keyboard |
RepositionKeyboard(Vector3, Single)
Function to reposition the Keyboard based on target position and vertical offset
Declaration
public void RepositionKeyboard(Vector3 kbPos, float verticalOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | kbPos | World position for keyboard |
Single | verticalOffset | Optional vertical offset of keyboard |
SetScaleSizeValues(Single, Single, Single, Single)
Method to set the sizes by code, as the properties are private. Useful for scaling 'from the outside', for instance taking care of differences between immersive headsets and HoloLens
Declaration
public void SetScaleSizeValues(float minScale, float maxScale, float minDistance, float maxDistance)
Parameters
Type | Name | Description |
---|---|---|
Single | minScale | Min scale factor |
Single | maxScale | Max scale factor |
Single | minDistance | Min distance from camera |
Single | maxDistance | Max distance from camera |
SetScaleSizeValues(Single, Single, Single, Single)
Method to set the sizes by code, as the properties are private. Useful for scaling 'from the outside', for instance taking care of differences between immersive headsets and HoloLens
Declaration
public void SetScaleSizeValues(float minScale, float maxScale, float minDistance, float maxDistance)
Parameters
Type | Name | Description |
---|---|---|
Single | minScale | Min scale factor |
Single | maxScale | Max scale factor |
Single | minDistance | Min distance from camera |
Single | maxDistance | Max distance from camera |
Shift(Boolean)
Set the keyboard to a single action shift state.
Declaration
public void Shift(bool newShiftState)
Parameters
Type | Name | Description |
---|---|---|
Boolean | newShiftState | value the shift key should have after calling the method |
Shift(Boolean)
Set the keyboard to a single action shift state.
Declaration
public void Shift(bool newShiftState)
Parameters
Type | Name | Description |
---|---|---|
Boolean | newShiftState | value the shift key should have after calling the method |
ShowAlphaKeyboard()
Enable the alpha keyboard.
Declaration
public void ShowAlphaKeyboard()
ShowAlphaKeyboard()
Enable the alpha keyboard.
Declaration
public void ShowAlphaKeyboard()
ShowSymbolKeyboard()
Enable the symbol keyboard.
Declaration
public void ShowSymbolKeyboard()
ShowSymbolKeyboard()
Enable the symbol keyboard.
Declaration
public void ShowSymbolKeyboard()
Space()
Insert a space character.
Declaration
public void Space()
Space()
Insert a space character.
Declaration
public void Space()
Start()
Set up Dictation, CanvasEX, and automatically select the TextInput object.
Declaration
protected override void Start()
Start()
Set up Dictation, CanvasEX, and automatically select the TextInput object.
Declaration
protected override void Start()
Tab()
Insert a tab character.
Declaration
public void Tab()
Tab()
Insert a tab character.
Declaration
public void Tab()
UnregisterHandlers()
Declaration
protected override void UnregisterHandlers()
UnregisterHandlers()
Declaration
protected override void UnregisterHandlers()
Events
OnClosed
Fired every time the close button is pressed. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnClosed
Event Type
Type | Description |
---|---|
EventHandler |
OnClosed
Fired every time the close button is pressed. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnClosed
Event Type
Type | Description |
---|---|
EventHandler |
OnKeyboardShifted
Event fired when shift key on keyboard is pressed.
Declaration
public event Action<bool> OnKeyboardShifted
Event Type
Type | Description |
---|---|
Action<Boolean> |
OnKeyboardShifted
Event fired when shift key on keyboard is pressed.
Declaration
public event Action<bool> OnKeyboardShifted
Event Type
Type | Description |
---|---|
Action<Boolean> |
OnNext
Sent when the 'Next' button is pressed. Ideally you would use this event to set your targeted text input to the next text field in your document. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnNext
Event Type
Type | Description |
---|---|
EventHandler |
OnNext
Sent when the 'Next' button is pressed. Ideally you would use this event to set your targeted text input to the next text field in your document. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnNext
Event Type
Type | Description |
---|---|
EventHandler |
OnPlacement
Sent when the keyboard is placed. This allows listener to know when someone else is co-opting the keyboard.
Declaration
public event EventHandler OnPlacement
Event Type
Type | Description |
---|---|
EventHandler |
OnPlacement
Sent when the keyboard is placed. This allows listener to know when someone else is co-opting the keyboard.
Declaration
public event EventHandler OnPlacement
Event Type
Type | Description |
---|---|
EventHandler |
OnPrevious
Sent when the 'Previous' button is pressed. Ideally you would use this event to set your targeted text input to the previous text field in your document. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnPrevious
Event Type
Type | Description |
---|---|
EventHandler |
OnPrevious
Sent when the 'Previous' button is pressed. Ideally you would use this event to set your targeted text input to the previous text field in your document. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnPrevious
Event Type
Type | Description |
---|---|
EventHandler |
OnTextSubmitted
Sent when the 'Enter' button is pressed. To retrieve the text from the event, cast the sender to 'Keyboard' and get the text from the TextInput field. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnTextSubmitted
Event Type
Type | Description |
---|---|
EventHandler |
OnTextSubmitted
Sent when the 'Enter' button is pressed. To retrieve the text from the event, cast the sender to 'Keyboard' and get the text from the TextInput field. (Cleared when keyboard is closed.)
Declaration
public event EventHandler OnTextSubmitted
Event Type
Type | Description |
---|---|
EventHandler |
OnTextUpdated
Fired every time the text in the InputField changes. (Cleared when keyboard is closed.)
Declaration
public event Action<string> OnTextUpdated
Event Type
Type | Description |
---|---|
Action<String> |
OnTextUpdated
Fired every time the text in the InputField changes. (Cleared when keyboard is closed.)
Declaration
public event Action<string> OnTextUpdated
Event Type
Type | Description |
---|---|
Action<String> |