Exemplo n.º 1
0
        private static void InsertTextCore(
			TextBox host, 
			string textToInsert,
			int selectionStart,
			int selectionLength)
        {
            // delete if overwriting something
            if (selectionLength > 0)
            {
                DeleteSelectionCore(host, selectionStart, selectionLength);
            }

            // modify the string
            if (selectionStart == host.DynamicString.Length)
            {
                host.DynamicString.Append(textToInsert);
            }
            else
            {
                host.DynamicString.Insert(selectionStart, textToInsert);
            }

            // update caret and selection
            host.SetCaretPosition(selectionStart + textToInsert.Length);
        }
Exemplo n.º 2
0
        public CaretPositionChangedEventArgs(
			TextBox textControl,
			int oldPosition,
			int newPosition)
        {
            TextControl = textControl;
            OldPosition = oldPosition;
            NewPosition = newPosition;
        }
Exemplo n.º 3
0
            public DeleteTextAction(
				TextBox hostTextBox, 
				int selStart, 
				int selLength
			)
                : base(hostTextBox)
            {
                selectionStart = selStart;
                selectionLength = selLength;
                deletedText = Textbox.Text.Substring(selectionStart, selectionLength);
            }
Exemplo n.º 4
0
        private static void DeleteSelectionCore(
			TextBox host,
			int selectionStart,
			int selectionLength)
        {
            if (selectionLength <= 0)
            {
                return;
            }

            // modify the string
            host.DynamicString.Remove(selectionStart, selectionLength);

            // update caret and selection
            host.SetCaretPosition(selectionStart);
        }
Exemplo n.º 5
0
 public TextBoxAction(TextBox hostTextBox)
 {
     Textbox = hostTextBox;
 }
Exemplo n.º 6
0
            public InsertTextAction(
				TextBox hostTestBox, 
				string text,
				int selStart,
				int selLength
			)
                : base(hostTestBox)
            {
                selectionStart = selStart;
                selectionLength = selLength;
                textToInsert = text;
                deletedText = Textbox.Text.Substring(selectionStart, selectionLength);
            }
Exemplo n.º 7
0
 private void mMyTextBox_TextBoxChangePending(TextBox sender, TextBoxChangeEventArgs e)
 {
     if (this.ActionManager != null && ShouldRecordActions)
     {
         IAction a = e.Action;
         e.Handled = true;
         this.ActionManager.RecordAction(a);
     }
 }
Exemplo n.º 8
0
 public TextBoxBlock(string defaultText)
 {
     MyTextBox = new TextBox(defaultText);
     Init();
 }
Exemplo n.º 9
0
 public TextBoxBlock()
 {
     MyTextBox = new TextBox();
     Init();
 }