ITfRange interface
The ITfRange interface is used by text services and applications to reference and manipulate text within a given context. The interface ID is IID_ITfRange.
Members
The ITfRange interface inherits from the IUnknown interface. ITfRange also has these types of members:
Methods
The ITfRange interface has these methods.
| Method | Description |
|---|---|
| AdjustForInsert |
Expands or contracts a range for text insertion. |
| Clone |
Duplicates the range. |
| Collapse |
Empties the range by moving its start anchor and end anchor to the same position. |
| CompareEnd |
Compares the position of this range end anchor to an anchor in another range. |
| CompareStart |
Compares the position of this range start anchor to an anchor in another range. |
| GetContext |
Obtains the context object to which the range belongs. |
| GetEmbedded |
Obtains content corresponding to a TF_CHAR_EMBEDDED character in the text stream. |
| GetFormattedText |
Obtains specially formatted content contained within a range. |
| GetGravity |
Obtains the gravity of the anchors in the object. |
| GetText |
Obtains content covered by this range of text. |
| InsertEmbedded |
Inserts an object at the location of the start anchor of the range. |
| IsEmpty |
Verifies that the range is empty, because the start anchor and end anchor occupy the same position. |
| IsEqualEnd |
Verifies that the end anchor of this range matches an anchor of another specified range. |
| IsEqualStart |
Verifies that the start anchor of this range matches an anchor of another specified range. |
| SetGravity |
Sets the gravity of the anchors in the object. |
| SetText |
Replaces content covered by the range. |
| ShiftEnd |
Moves the end anchor of the range. |
| ShiftEndRegion |
Moves the end anchor into an adjacent region. |
| ShiftEndToRange |
Moves the end anchor of this range to an anchor within another range. |
| ShiftStart |
Moves the start anchor of the range. |
| ShiftStartRegion |
Moves the start anchor into an adjacent region. |
| ShiftStartToRange |
Moves the start anchor of this range to an anchor within another range. |
Remarks
The TSF manager implements this interface. For more information about ranges, anchors, embedded objects, and other text properties used by TSF, see Ranges, Embedded Objects, and other topics within Using Text Services Framework.
Examples
Once an ITfComposition composition object is instantiated, a pointer to an ITfRange interface pointer can be obtained by calling the ITfComposition::GetRange method, as shown in the following code example.
HRESULT hr; ITfComposition *pComposition; ITfRange *pRange; WCHAR *achBuffer[64]; // Buffer to receive text. ULONG cch; hr = pComposition->GetRange(&pRange); if(SUCCEEDED(hr)) { // Loop to scan text: do { cch = ARRAYSIZE(achBuffer); hr = pRange->GetText(ec, TF_TF_MOVESTART | TF_TF_IGNOREEND, achBuffer, cch, &cch); if(SUCCEEDED(hr)) { // Do something with the text. pRange->Release(); } } while (cch == ARRAYSIZE(achBuffer)); pComposition->Release(); }
A pointer to a current ITfRange object can be obtained from the <range> element of the TF_SELECTION structure.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Redistributable |
TSF 1.0 on Windows 2000 Professional |
|
Header |
|
|
IDL |
|
|
DLL |
|
See also
- IUnknown
- Ranges
- Embedded Objects
- Using Text Services Framework
- ITfComposition
- ITfComposition::GetRange
- Compositions
- TF_SELECTION