pub struct UiAutomationTextRange(/* private fields */);Expand description
提供对支持 IUIAutomationTextPattern 接口的容器中连续文本范围的访问。 客户端应用程序可以使用 IUIAutomationTextRange 接口从文本范围中选择、比较和查询嵌入对象。 该接口使用两个端点来分隔文本范围的开始和结束位置。 文本的不相交范围由 IUIAutomationTextRangeArray 接口表示。
Implementations§
Source§impl UiAutomationTextRange
impl UiAutomationTextRange
Sourcepub fn compare(&self, range: &UiAutomationTextRange) -> bool
pub fn compare(&self, range: &UiAutomationTextRange) -> bool
查询一个值,该值指定此文本区域是否与另一个文本区域具有相同的端点。
range 指向要与此范围进行比较的文本范围。
Sourcepub fn add_to_selection(&self)
pub fn add_to_selection(&self)
将文本区域添加到支持所选文本的多个不相交范围的控件中的选定文本范围的集合中。
Sourcepub fn compare_endpoints(
&self,
src_start_endpoint: bool,
range: &UiAutomationTextRange,
target_start_endpoint: bool,
) -> i32
pub fn compare_endpoints( &self, src_start_endpoint: bool, range: &UiAutomationTextRange, target_start_endpoint: bool, ) -> i32
查询一个值,该值指定此文本区域的起始或结束端点是否与另一个文本区域的起始或结束端点相同。
src_start_endpoint 源范围的端点类型,如果是true表示使用起始点,false表示使用结束点。
range 要比较的文本区域。
target_start_endpoint 目标范围的端点类型,如果是true表示使用起始点,false表示使用结束点。
Sourcepub fn expand_to_enclosing_unit(&self, text_unit: TextUnit)
pub fn expand_to_enclosing_unit(&self, text_unit: TextUnit)
按指定的文本单位规范化文本范围。
客户端应用程序(如屏幕阅读器)使用此方法检索插入点或插入符号位置处存在的完整单词、句子或段落。
尽管名称如此,但 expand_to_enclosing_unit 方法不一定扩展文本范围。
相反,它通过移动终结点来“规范化”文本范围,使该范围包含指定的文本单元。
如果范围小于指定单位,则扩大范围,如果范围长于指定单位,则缩短范围。
如果范围已经是指定单位的确切数量,则保持不变。
如果控件不支持指定的文本单位,则 expand_to_enclosing_unit 默认为支持的下一个最大文本单元。
从最小单位到最大单位的顺序如下: 字符、格式、词、行、段、页、文档。
expand_to_enclosing_unit 同时支持可见文本和隐藏文本。
Format,作为单位值,定位文本范围的边界,以根据范围内文本的共享文本属性(或格式)来扩展或移动范围。但是,文本单元不会在嵌入对象(如图像或超链接)的边界上移动或扩展文本范围。
有关详细信息,请参阅 UI 自动化文本单元或文本内容的 UI 自动化支持。
text_unit 文本单位,例如行或段落。
Trait Implementations§
Source§impl Clone for UiAutomationTextRange
impl Clone for UiAutomationTextRange
Source§fn clone(&self) -> UiAutomationTextRange
fn clone(&self) -> UiAutomationTextRange
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more