Share via


ITextRangeProvider::Move Method

Moves the text range the specified number of text units.

Syntax

HRESULT Move(      
    TextUnit unit,
    int count,
    int *pRetVal
);

Parameters

  • unit
    [in] A value from the TextUnit enumerated type specifying the type of units (character, word, paragraph, and so on).
  • count
    [in] The number of text units to move. A positive value moves the text range forward. A negative value moves the text range backward. Zero has no effect.
  • pRetVal
    [out, retval]  The number of units actually moved. This can be less than the number requested if either of the new text range endpoints is greater than or less than the ITextProvider::DocumentRange endpoints.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

For a degenerate text range, ITextRangeProvider::Move tries to move the insertion point the specified number of text units.

For a non-degenerate text range where count is greater than zero, ITextRangeProvider::Move collapses the text range to its ending endpoint, moves the resulting text range forward to a text unit boundary (if it's not already at one), and then attempts to move the ending endpoint forward count - 1 text units.

ITextRangeProvider::Move respects both hidden and visible text.

ITextRangeProvider::Move deprecates up to the next supported text unit if the given text unit is not supported by the control.

The order, from smallest unit to largest, is listed here.

  • Character
  • Format
  • Word
  • Line
  • Paragraph
  • Page
  • Document

The text is not altered in any way, the text range just spans a different part of the text.

See Also

UI Automation Providers Overview, ITextProvider