DXCore Services – Text Views
November 28th, 2011
The TextViews DXCore service provides methods and properties for text view manipulation. A text view is a window in Visual Studio IDE that lets you type, edit and view source code text.
Methods of this service:
Method name |
Description |
CreateNewTextView(IVsTextView) | Creates and registers a new text view from the specified IVsTextView and VsTextEditPane sub-class. |
FindByHandle(HWND) | Returns an IVsTextView text view instance by the given HWND. |
Focus(TextView) | Focuses the specified text view. |
GdiPaint(EditorPaintEventHandler) | Iterates through all text views for the active document, calling the specified event handler. |
Get | Returns an array of text views for the active text document. |
Get(Boolean) | Returns an array of text views for the active text document. A boolean parameter specifies whether errors are suppressed (a method will return null) or not (an exception will be thrown). |
Get(TextDocument) | Returns an array of text views for the specified text document. |
Get(TextDocument, Boolean) | Returns an array of text views for the specified text document. A boolean parameter specifies whether errors are suppressed (a method will return null) or not (an exception will be thrown). |
GetEnumerator | Returns an enumerator for active text views. |
Refresh | Invalidates all text views. |
RequestTextView(IVsTextView) | Returns an existing text view by the given IVsTextView instance or creates a new one. |
RestorePosition(ViewPosition) | Restores the specified view. If the file associated with the view has been closed, it will be reopened. The restored text view is returned. NOTE: This method sets focus to the restored by posting a message to the TextView’s message queue. So, calling CodeRush.TextViews.Active or TextView.Active is not guaranteed to return the newly restored text view until that message is handled. If any other operations need to be performed on the restored view, use the text view returned by this method. |
SavePosition | Creates and returns a new ViewPosition object for the active text view. |
SavePosition(TextView) | Creates and returns a new ViewPosition object for the specified text view. |
Properties:
Property name |
Description |
Active | Gets the active text view. |
Count | Get the count of active text views. |
ImeCompositionActive | Determines whether an IME composition is in an active state, and we’re waiting for the end of the composition. IME stands for Input Method Editor. IMEs are typically used to input unicode characters such as Kanji. |
Item | An indexed property that returns a text view by the given index. |
LineHeight | Returns the line height of the active text view. If there is no active text view, zero is returned. |