예제 #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);
        }
예제 #2
0
        public CaretPositionChangedEventArgs(
			TextBox textControl,
			int oldPosition,
			int newPosition)
        {
            TextControl = textControl;
            OldPosition = oldPosition;
            NewPosition = newPosition;
        }
예제 #3
0
            public DeleteTextAction(
				TextBox hostTextBox, 
				int selStart, 
				int selLength
			)
                : base(hostTextBox)
            {
                selectionStart = selStart;
                selectionLength = selLength;
                deletedText = Textbox.Text.Substring(selectionStart, selectionLength);
            }
예제 #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);
        }
예제 #5
0
 public TextBoxAction(TextBox hostTextBox)
 {
     Textbox = hostTextBox;
 }
예제 #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);
            }
예제 #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);
     }
 }
예제 #8
0
 public TextBoxBlock(string defaultText)
 {
     MyTextBox = new TextBox(defaultText);
     Init();
 }
예제 #9
0
 public TextBoxBlock()
 {
     MyTextBox = new TextBox();
     Init();
 }