private void RemoveText(int start, int length, int newTextPos = -1) { if (EditorParams.UseSecureString) { HideSelection(); for (int i = 0; i < length; ++i) { Password.RemoveAt(start); } Text.Invalidate(); } else { History.Add(MakeUndoItem()); HideSelection(); Text.Text = Text.Text.Remove(start, length); } if (start <= lastChar.Pos && lastChar.Pos < start + length) { lastChar.ShowTimeLeft = 0; } if (newTextPos >= 0) { CaretPos.TextPos = newTextPos; } CaretPos.InvalidatePreservingTextPos(); }
private void ApplyUndoItem(UndoItem i) { lastChar.ShowTimeLeft = 0; Text.Text = i.Value; CaretPos.TextPos = i.TextPos; CaretPos.InvalidatePreservingTextPos(); }
//rempli le champ imput avec le symbole selectionné public void CompleteIField() { iField = focusHandler.getCurrentFormule(); if (iField == null) { iField = backupField; } caret = (CaretPos)iField.GetComponent(typeof(CaretPos)); ClavierEnum clavierEnum = (ClavierEnum)Enum.Parse(typeof(ClavierEnum), symb, true); String realSymb = GetEnumDescription(clavierEnum); caretPos = caret.getCaretPos(); try { iField.text = iField.text.Substring(0, caretPos) + realSymb + iField.text.Substring(caretPos); caretPos += realSymb.Length; caret.setCaretPos(caretPos); /* On a ajouter un caractère */ } catch (ArgumentOutOfRangeException) /* Utile si l'utilisateur fait une selection et la supprime */ { iField.text += realSymb; caretPos = iField.text.Length; caret.setCaretPos(caretPos); } iField.Select(); iField.ActivateInputField(); StartCoroutine(MoveTextEnd()); }
public override void Draw(BaseScreen.Resources screenResources, SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle?clip = null, Texture2D bgTexture = null, Vector2?scrollOffset = null) { string txt = Text.Value(); if (!string.IsNullOrWhiteSpace(Symbol.Value())) { MDL2Symbols symbol = (MDL2Symbols)Enum.Parse(typeof(MDL2Symbols), Symbol.Value()); txt = symbol.AsChar(); } if (FontName.Value != null) { this.ActualSize = DrawFontAsset(spriteBatch, screen, opacity, txt, FontColor.Value(), ActualPosition, FontSize.Value(), LineHeight.Value(), FontName.Value(), PseudoAntiAlias.Value(), WordWrap.Value(), Justification.Value(), FontMargin.Value(), Margin.Value(), OutlineColor.Value(), Clip, bgTexture, scrollOffset, CaretPos.Value(), MultiLine.Value(), ScissorRect); } if (Position.Value.Height == 0) { autoSize = true; } if (autoSize) { this.Position.Value = new FloatRectangle(Position.Value.X, Position.Value.Y, Position.Value.Width, ActualSize.Y); } }