protected override void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { base.OnKeyPress(sender, e); if (e.KeyChar == ' ') { if (MyTextBox.CaretPosition == MyTextBox.Text.Length) { Block next = this.Next; if (next != null && next is SpaceBlock) { next.SetFocus(true); } } else if (MyTextBox.CaretPosition > 0) { string TextBeforeCaret = MyTextBox.TextBeforeCaret; string TextAfterCaret = MyTextBox.TextAfterCaret; using (ActionBuilder a = new ActionBuilder(this.Root)) { a.RenameItem(MyTextBox, TextBeforeCaret); a.AppendBlocks( this, new TokenSeparatorBlock(), new TokenBlock(TextAfterCaret) ); a.Run(); } } } }