ISECEditBuffer::GetTextBlock

Retrieves a pointer to or copies a block of text from the text buffer.

Defined in: ISECEditBuffer.h

Syntax

virtual int GetTextBlock(LPCTSTR& lpszBlock, int nStartLine, int nStartCol = 0, int nEndLine = -1, int nEndCol = -1)

virtual BOOL GetTextBlock(CString& strBlock, int nStartLine, int nStartCol = 0, int nEndLine = -1, int nEndCol = -1)

Return Value

One of the overloaded methods returns the number of characters contained in the requested text, or -1 for failure. The other returns non-zero if successful; otherwise 0.

Parameters

lpszBlock

Output parameter. Reference to the block of text to be set.

strBlock

Output parameter. Reference to a CString that the requested block is copied into.

nStartLine

The starting line index for the requested block of text.

nStartCol

The starting column index on the starting line.

nEndLine

The ending line index for the requested block of text.

nEndCol

The ending column index on the ending line.

Comments

If nEndLine and nEndCol are -1, then the requested block is up to and including the line end characters of the line specified by nStartLine.

Developer Notes

SECEditViewport , SECEditController, and SECEdit will always call the first override that sets the pointer to the block of text. If this returns -1, then Objective Edit will call the second override that takes the CString reference parameter. The provided implementation of ISECEditBuffer, SECEditBlockBuffer stores its text in an array of blocks of text, so it can always return the pointer to the text unless the requested text spans a block boundary. These blocks are always bounded by a line end, so a request for the pointer to text on a single line will always succeed when using the default implementation. If you derive your own implementation of ISECEditBuffer, it is recommended that you return the pointer to the text if possible, even if on a line by line basis.

See Also

ISECEditBuffer SECEditBlockBuffer