protected override void CreateDisplayObject() { inputTextField = new InputTextField(); inputTextField.gOwner = this; displayObject = inputTextField; _textField = inputTextField.textField; }
public void StartRecord(InputTextField textField) { _undoBuffer.Clear(); _redoBuffer.Clear(); _textField = textField; _lock = false; _currentText = textField.text; _changedFrame = 0; }
void HandleTextInput() { InputTextField textField = (InputTextField)_focused; if (!textField.editable) { return; } textField.CheckComposition(); }
void OnFocusRemoved(EventContext context) { if (context.sender == _focused) { if (_focused is InputTextField) { _lastInput = null; } this.focus = null; } }
/// <summary> /// /// </summary> /// <param name="textField"></param> /// <param name="value"></param> public static void OnCopy(InputTextField textField, string value) { TextEditor te = new TextEditor(); #if UNITY_5_3_OR_NEWER te.text = value; #else te.content = new GUIContent(value); #endif te.OnFocus(); te.Copy(); }
public void StopRecord(InputTextField textField) { if (_textField != textField) { return; } _undoBuffer.Clear(); _redoBuffer.Clear(); _textField = null; _currentText = null; }
/// <summary> /// /// </summary> /// <param name="textField"></param> public static void OnPaste(InputTextField textField) { TextEditor te = new TextEditor(); te.Paste(); #if UNITY_5_3_OR_NEWER string value = te.text; #else string value = te.content.text; #endif if (!string.IsNullOrEmpty(value)) textField.ReplaceSelection(value); }
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()); } } } }
/// <summary> /// /// </summary> /// <param name="textField"></param> public static void OnPaste(InputTextField textField) { TextEditor te = new TextEditor(); te.Paste(); #if UNITY_5_3_OR_NEWER string value = te.text; #else string value = te.content.text; #endif if (!string.IsNullOrEmpty(value)) { textField.ReplaceSelection(value); } }
static int get_inputTextField(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; FairyGUI.InputTextField ret = obj.inputTextField; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index inputTextField on a nil value")); } }
public void MarkChanged(InputTextField textField) { if (_textField != textField) { return; } if (_lock) { return; } string newText = _textField.text; if (_currentText == newText) { return; } if (_changedFrame != Time.frameCount) { _changedFrame = Time.frameCount; _undoBuffer.Add(_currentText); if (_undoBuffer.Count > maxHistoryLength) { _undoBuffer.RemoveAt(0); } } else { int cnt = _undoBuffer.Count; if (cnt > 0 && newText == _undoBuffer[cnt - 1]) { _undoBuffer.RemoveAt(cnt - 1); } } _currentText = newText; }
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(); } }