pub struct UiAutomationTextPattern2(/* private fields */);Expand description
扩展 UiAutomationTextPattern。
Implementations§
source§impl UiAutomationTextPattern2
impl UiAutomationTextPattern2
sourcepub fn get_caret_range(&self) -> Option<(bool, UiAutomationTextRange)>
pub fn get_caret_range(&self) -> Option<(bool, UiAutomationTextRange)>
查询属于基于文本的控件的插入符号位置的零长度文本范围。
此方法检索一个文本区域,客户端可以使用该文本区域查找属于基于文本的控件的插入符号的边界矩形,或查找插入符号附近的文本。
返回(is_active,range)。
is_active 如果包含插入符号的基于文本的控件具有键盘焦点,则为 true,否则为 false。如果 is_active 为 false,则属于基于文本的控件的插入符号可能与系统插入符号位于同一位置。
range 接收一个文本范围,该范围表示属于基于文本的控件的插入符号的当前位置。
sourcepub fn range_from_annotation(
&self,
annotation: &UiAutomationElement,
) -> UiAutomationTextRange
pub fn range_from_annotation( &self, annotation: &UiAutomationElement, ) -> UiAutomationTextRange
查询包含文本的文本范围,该文本是与指定批注元素关联的批注的目标。
annotation 要检索其目标文本的批注元素。此元素是实现文档的 UiAutomationTextPattern2 的元素的同级元素。
Methods from Deref<Target = UiAutomationTextPattern>§
sourcepub fn document_range(&self) -> UiAutomationTextRange
pub fn document_range(&self) -> UiAutomationTextRange
查询包含文档正文的文本范围。 此属性是只读的。 某些辅助文本(如页眉、脚注或批注)可能不包括在内。
sourcepub fn get_selection(&self) -> Vec<UiAutomationTextRange>
pub fn get_selection(&self) -> Vec<UiAutomationTextRange>
查询文本范围的集合,该集合表示基于文本的控件中当前选定的文本。 如果控件支持选择多个不连续的文本范围,则 ranges 集合将为每个选定的范围接收一个文本范围。 如果控件仅包含所选文本的单个范围,则 ranges 集合将接收单个文本范围。 如果控件包含文本插入点,但未选择任何文本,则 ranges 集合将在文本插入点的位置接收一个退化(空)文本区域。 如果控件不包含文本插入点或不支持文本选择,则范围设置为 NULL。 使用 supported_text_selection 属性测试控件是否支持文本选择。
sourcepub fn supported_text_selection(&self) -> SupportedTextSelection
pub fn supported_text_selection(&self) -> SupportedTextSelection
查询一个值,该值指定控件支持的文本选择的类型。 此属性是只读的。
sourcepub fn get_visible_ranges(&self) -> Vec<UiAutomationTextRange>
pub fn get_visible_ranges(&self) -> Vec<UiAutomationTextRange>
从基于文本的控件中检索不相交的文本范围的数组,其中每个文本区域表示可见文本的连续范围。
sourcepub fn range_from_child(
&self,
child: &UiAutomationElement,
) -> Option<UiAutomationTextRange>
pub fn range_from_child( &self, child: &UiAutomationElement, ) -> Option<UiAutomationTextRange>
查询包含子元素(如图像、超链接、Microsoft Excel 电子表格或其他嵌入对象)的文本区域。
如果区域中没有包含子元素的文本,则返回退化(空)区域。
child 要包含在文本范围中的子元素,可以是与 UiAutomationTextPattern 关联的元素的子参数,也可以是 UiAutomationTextRange 的子元素数组的子参数。
sourcepub fn range_from_point(&self, x: i32, y: i32) -> Option<UiAutomationTextRange>
pub fn range_from_point(&self, x: i32, y: i32) -> Option<UiAutomationTextRange>
查询最接近指定屏幕坐标的退化(空)文本范围。 如果屏幕坐标位于图像、超链接、Microsoft Excel 电子表格或其他嵌入对象的坐标内,则返回换行子对象的文本区域。 由于不会忽略隐藏文本,因此此方法从最接近指定坐标的可见文本中检索退化范围。 Windows Internet Explorer 9 中 range_from_point 的实现不会返回预期的结果。相反,客户应该:
- 调用get_visible_ranges方法以检索可见文本范围的数组。
- 对于数组中的每个文本范围,调用get_bounding_rectangles以检索边界矩形。
- 检查边界矩形以查找占据特定屏幕坐标的文本范围。