BeginUpdate() | EndUpdate() brackets

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Alex_3333
Avatar
Has SyntaxEditor something likes BeginUpdate() | EndUpdate() brackets of TreeView class? Will this in future if it is not now? For example, sequence building of the text by AppendText() causes some repaintings. Caret position can be not changed inside those brackets only after out they.

Comments (8)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alex,

Yes we have similar methods. Try them out:

SyntaxEditor.SuspendPainting()
SyntaxEditor.ResumePainting()


Actipro Software Support

Posted 15 years ago by Alex_3333
Avatar
Thank you for your quick help and sorry for my stupid question <IMG SRC="smile.gif" border="0"> But I continue since I had begun. Can I freeze caret position during repeated calls of AppendText() to avoid SelectionChanged event?
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Not yet but that is something that we have on the TODO list from another posting.


Actipro Software Support

Posted 6 years ago by Mike Griffin - Chier Technology Officer, Phurion, LLC
Avatar

This doesn't seem to work when looping through a DocumentLineCollection and changing each line, or at least the scroll bar still moves and you end up and the end of the document. Probably need to turn off some kind of keep current row visible state but can't find that, I'm changes a bunch of lines and SuspendPainting() doesn't stop it from scrolling to the bottom, hmmm ...

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

Hi Mike,

You can pass DocumentModificationFlags.RetainSelection to the document modification overloads to keep the caret from moving to the end of the modification.


Actipro Software Support

Posted 6 years ago by Mike Griffin - Chier Technology Officer, Phurion, LLC
Avatar

I saw that you can use that on Document.ReplaceText() but this is my code

private void ReplaceBlankLinesWithDot(DocumentLineCollection lines)
{
    foreach(DocumentLine line in lines)
    {
        string tmp = line.Text;

        tmp = tmp.Replace("\t", "");
        tmp = tmp.Trim();
        if (tmp.Length == 0)
        {
            line.Text = ".";
        }
    }
}

 So I'm changing each line (possibly) and don't really see how I can use that. I'm think I'm just stuck with it scrolling.

[Modified 6 years ago]

Posted 6 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar

You shouldn't edit the strings directly. You should work with the methods the Document offers instead.

foreach(DocumentLine line in lines)
{
  Document.ReplaceText(DocumentModificationType.Custom, line.TextRange, newText, DocumentModificationOptions.RetainSelection);
}


Best regards, Tobias Lingemann.

Posted 6 years ago by Mike Griffin - Chier Technology Officer, Phurion, LLC
Avatar

Worked perfectly thanks, sure made it work faster too, again, thanx ...

The latest build of this product (v2018.1 build 0342) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.