Document.DeleteText

SyntaxEditor for WPF Forum

Posted 14 years ago by Arie Osherov - Cellebrite
Avatar
Hi.

SyntaxEditor 9.2.515.0

When text is being deleted with Document.DeleteText() the Track's Thumb is jumping to beginning of the document.

But if i use Document.AppendText(), Thumb does not move.

this is my code:

var txtChangeOptions = new ActiproSoftware.Text.Implementation.TextChangeOptions();
txtChangeOptions.RetainSelection = true;
_Editor.Document.AppendText(ActiproSoftware.Text.TextChangeTypes.Typing, "........", txtChangeOptions);


var txtChangeOptions = new ActiproSoftware.Text.Implementation.TextChangeOptions();
txtChangeOptions.RetainSelection = true;
_Editor.Document.DeleteText(ActiproSoftware.Text.TextChangeTypes.Delete, 0, 100, txtChangeOptions);


What can i do to prevent thumb from moving when i am using Document.DeleteText()?

Thanks in advance

[Modified at 08/11/2010 08:29 AM]

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

A text change made above the caret will cause the view to scroll to the caret. This is why the view is scrolling when you call DeleteText and not with AppendText.

The RetainSelection option tells SyntaxEditor not to move the caret to the end of the change. Because the code you provided is setting RetainSelection to true, the caret is staying where it is.

You can set the SyntaxEditor.ActiveView.ScrollToCaretOnSelectionChange option to false prior to calling DeleteText to prevent the view from scrolling to the caret.

Please let us know if you have further questions.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.