- Home /
Question by
SirSatlyStudios · Dec 11, 2020 at 08:50 AM ·
inputfieldtab
Using Tab onValidateInput in single line Input Field;
I have created a script to allows you to tab between input fields for my app using onValidateInput. I works perfectly on multiline input fields but on single line fields its not working due to you being unable to type the tab key in them. Is there anyway using either settings on the input field or code that I could either allow the tab key in single line or bypass it in some way for my code. I have placed my current sctript below.
using UnityEngine;
using UnityEngine.UI;
public class TabInput : MonoBehaviour
{
[SerializeField]
private InputField tabTo;
private InputField input;
void Start()
{
input = GetComponent<InputField>();
input.onValidateInput += delegate (string input, int charIndex, char addedChar)
{
if (addedChar == '\t')
{
tabTo.ActivateInputField();
return default;
}
else return addedChar;
};
}
}
Comment
Your answer
Follow this Question
Related Questions
How to select next UI element by pressing TAB? 1 Answer
Name for list item selection/movement bar? 0 Answers
Get text from Input field in C# 5 Answers