TextPoint TextPoint TextPoint TextPoint TextPoint TextPoint Interface

Definition

Represents a location of text in a text document.

public interface class TextPoint
public interface class TextPoint
__interface TextPoint
[System.Runtime.InteropServices.Guid("7F59E94E-4939-40D2-9F7F-B7651C25905D")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface TextPoint
type TextPoint = interface
Public Interface TextPoint
Derived
Attributes

Examples

Sub TextPointExample()  
   ' Comments a region of code.  
   Dim selection As TextSelection  
   selection = dte.ActiveDocument.selection()  
   Dim Start As Editpoint  
   Start = selection.TopPoint.CreateEditPoint()  
   Dim endpt As TextPoint endpt = selection.BottomPoint  
  
   Dim undoObj As UndoContext = dte.UndoContext  
   undoobj.Open("Comment Region")  
   Do While (Start.LessThan(endpt))  
      Start.Insert("//")  
      Start.LineDown()  
      Start.StartOfLine()  
   Loop  
   undoobj.Close()  
End Sub  

Remarks

The TextPoint object allows you to find locations in a document. Using the properties of the TextPoint object, you can find text with:

  • Line numbers

  • Character numbers in a line

  • Absolute character locations from the beginning of the document

  • Display columns

TextPoint objects are similar to EditPoint objects, except that they operate on text displayed in a code editor rather than data in the text buffer. Text in a document is affected by global editor states, such as word wrapping and virtual spaces, but the text buffer is not.

As you edit a document, TextPoint objects do not move relative to their surrounding text. That is, if text is inserted before a text point, then the value of its AbsoluteCharOffset property is incremented to reflect its new location further down in the document. If multiple TextPoint objects are at the same location and an EditPoint object is used to insert new text, then the new characters are to the right of all of the TextPoint objects except the one used to insert the text.

Any operation that attempts to modify a TextDocument object fails if the TextDocument is read-only.

Properties

AbsoluteCharOffset AbsoluteCharOffset AbsoluteCharOffset AbsoluteCharOffset AbsoluteCharOffset AbsoluteCharOffset

Gets the one-based character offset from the beginning of the document to the TextPoint object.

AtEndOfDocument AtEndOfDocument AtEndOfDocument AtEndOfDocument AtEndOfDocument AtEndOfDocument

Gets whether the object is at the end of the document.

AtEndOfLine AtEndOfLine AtEndOfLine AtEndOfLine AtEndOfLine AtEndOfLine

Gets whether or not object is at the end of a line.

AtStartOfDocument AtStartOfDocument AtStartOfDocument AtStartOfDocument AtStartOfDocument AtStartOfDocument

Gets whether or not the object is at the beginning of the document.

AtStartOfLine AtStartOfLine AtStartOfLine AtStartOfLine AtStartOfLine AtStartOfLine

Gets whether or not the object is at the beginning of a line.

CodeElement[vsCMElement] CodeElement[vsCMElement] CodeElement[vsCMElement] CodeElement[vsCMElement] CodeElement[vsCMElement] CodeElement[vsCMElement]

Returns the code element at the TextPoint location.

DisplayColumn DisplayColumn DisplayColumn DisplayColumn DisplayColumn DisplayColumn

Gets the number of the current displayed column containing the TextPoint object.

DTE DTE DTE DTE DTE DTE

Gets the top-level extensibility object.

Line Line Line Line Line Line

Gets the line number of the object.

LineCharOffset LineCharOffset LineCharOffset LineCharOffset LineCharOffset LineCharOffset

Gets the character offset of the object.

LineLength LineLength LineLength LineLength LineLength LineLength

Gets the number of characters in a line containing the object, excluding the new line character.

Parent Parent Parent Parent Parent Parent

Gets the immediate parent object of a TextPoint object.

Methods

CreateEditPoint() CreateEditPoint() CreateEditPoint() CreateEditPoint() CreateEditPoint() CreateEditPoint()

Creates and returns an EditPoint object at the location of the calling object.

EqualTo(TextPoint) EqualTo(TextPoint) EqualTo(TextPoint) EqualTo(TextPoint) EqualTo(TextPoint) EqualTo(TextPoint)

Returns whether the value of the given point object's AbsoluteCharOffset property is equal to that of the calling TextPoint object.

GreaterThan(TextPoint) GreaterThan(TextPoint) GreaterThan(TextPoint) GreaterThan(TextPoint) GreaterThan(TextPoint) GreaterThan(TextPoint)

Indicates whether or not the value of the calling object's AbsoluteCharOffset property is greater than that of the given point object.

LessThan(TextPoint) LessThan(TextPoint) LessThan(TextPoint) LessThan(TextPoint) LessThan(TextPoint) LessThan(TextPoint)

Indicates whether or not the value of the called object's AbsoluteCharOffset property is less than that of the given object.

TryToShow(vsPaneShowHow, Object) TryToShow(vsPaneShowHow, Object) TryToShow(vsPaneShowHow, Object) TryToShow(vsPaneShowHow, Object) TryToShow(vsPaneShowHow, Object) TryToShow(vsPaneShowHow, Object)

Attempts to display the text point's location.

Applies to