ReplaceText() public method

public ReplaceText ( string value ) : void
value string
return void
Example #1
0
        void HandleTextInput()
        {
            InputTextField textField = (InputTextField)_focused;

            if (!textField.editable)
            {
                return;
            }

            if (_keyboard != null)
            {
                if (textField.keyboardInput)
                {
                    string s = _keyboard.GetInput();
                    if (s != null)
                    {
                        if (_keyboard.supportsCaret)
                        {
                            textField.ReplaceSelection(s);
                        }
                        else
                        {
                            textField.ReplaceText(s);
                        }
                    }

                    if (_keyboard.done)
                    {
                        this.focus = null;
                    }
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Input.inputString))
                {
                    StringBuilder sb  = new StringBuilder();
                    int           len = Input.inputString.Length;
                    for (int i = 0; i < len; ++i)
                    {
                        char ch = Input.inputString[i];
                        if (ch >= ' ')
                        {
                            sb.Append(ch.ToString());
                        }
                    }
                    if (sb.Length > 0)
                    {
                        textField.ReplaceSelection(sb.ToString());
                    }
                }
            }
        }
Example #2
0
        void HandleTextInput()
        {
            InputTextField textField = (InputTextField)_focused;

            if (!textField.editable)
            {
                return;
            }

            if (keyboardInput)
            {
                if (textField.keyboardInput && _keyboard != null)
                {
                    string s = _keyboard.GetInput();
                    if (s != null)
                    {
                        if (_keyboard.supportsCaret)
                        {
                            textField.ReplaceSelection(s);
                        }
                        else
                        {
                            textField.ReplaceText(s);
                        }
                    }

                    if (_keyboard.done)
                    {
                        this.focus = null;
                    }
                }
            }
            else
            {
                textField.CheckComposition();
            }
        }