This topic has not yet been rated - Rate this topic

ITextRangeProvider::MoveEndpointByUnit method

Moves one endpoint of the text range the specified number of TextUnits within the document range.

Syntax


HRESULT MoveEndpointByUnit(
  [in]           TextPatternRangeEndpoint endpoint,
  [in]           TextUnit unit,
  [in]           int count,
  [out, retval]  int *pRetVal
);

Parameters

endpoint [in]

Type: TextPatternRangeEndpoint

The endpoint to move.

unit [in]

Type: TextUnit

The unit boundary.

count [in]

Type: int

The number of units to move. A positive value moves the endpoint forward. A negative value moves backward. A value of 0 has no effect.

pRetVal [out, retval]

Type: int*

Receives the number of units actually moved, which can be less than the number requested if moving the endpoint runs into the beginning or end of the document.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The endpoint is moved forward or backward, as specified, to the next available unit boundary. If the original endpoint was at the boundary of the specified text unit, the endpoint is moved to the next available text unit boundary, as shown in the following illustration.

Illustration showing endpoints of a text range moving

If the endpoint being moved crosses the other endpoint of the same text range, the other endpoint is also moved, resulting in a degenerate range and ensuring the correct ordering of the endpoint (that is, that the start is always less than or equal to the end).

ITextRangeProvider::MoveEndpointByUnit 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

Requirements

Minimum supported client

Windows XP [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2003 [desktop apps | Windows Store apps]

Header

UIAutomationCore.h (include UIAutomation.h)

IDL

UIAutomationCore.idl

See also

Reference
ITextProvider
ITextRangeProvider
Conceptual
UI Automation Providers Overview

 

 

Send comments about this topic to Microsoft

Build date: 5/16/2013

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.