Posted 15 years ago
by Matt Kerchmar
Hello,
I am attempting to implement an Output Window in my application to mimic functionality similar to Visual Studio's Output Window. I am using a SyntaxEditor control so that I can have syntax highlighting in the output window, because code will often be dumped to the output as the application is being used. As output text is appended to the window, the editor needs to stay scrolled to the end.
Is this not the correct function for this purpose?
SyntaxEditor.ActiveView.Scroller.ScrollToDocumentEnd()
I verified with a breakpoint that this line is getting hit when text is appended to the editor control (as expected). But it doesn't scroll.
An alternative method I thought of involved determining the number of lines in the document and simply scrolling to the last line with:
SyntaxEditor.Caret.Position = new TextPosition(lastLine, 0);
or
SyntaxEditor.ActiveView.FirstVisiblePosition = new TextPosition(lastLine, 0);
But, unfortunately, I don't know how to determine the number of lines in a document (I have another forum posting that asks this question for another purpose).
Any suggestions would be greatly appreciated.
Thanks,
Matt Kerchmar
I am attempting to implement an Output Window in my application to mimic functionality similar to Visual Studio's Output Window. I am using a SyntaxEditor control so that I can have syntax highlighting in the output window, because code will often be dumped to the output as the application is being used. As output text is appended to the window, the editor needs to stay scrolled to the end.
Is this not the correct function for this purpose?
SyntaxEditor.ActiveView.Scroller.ScrollToDocumentEnd()
I verified with a breakpoint that this line is getting hit when text is appended to the editor control (as expected). But it doesn't scroll.
An alternative method I thought of involved determining the number of lines in the document and simply scrolling to the last line with:
SyntaxEditor.Caret.Position = new TextPosition(lastLine, 0);
or
SyntaxEditor.ActiveView.FirstVisiblePosition = new TextPosition(lastLine, 0);
But, unfortunately, I don't know how to determine the number of lines in a document (I have another forum posting that asks this question for another purpose).
Any suggestions would be greatly appreciated.
Thanks,
Matt Kerchmar