中文 | English
API: UIA ScrollBar
The ScrollBar control is used to scroll a content area. There are two types: horizontal and vertical.
Finding a ScrollBar
Note: ScrollBars usually have names, or can be located by type.
from wingman import uia
# 查找垂直滚动条
v_scroll = uia.find_by_name("垂直滚动条")
if v_scroll:
print("找到垂直滚动条")
# 查找水平滚动条
h_scroll = uia.find_by_name("水平滚动条")
if h_scroll:
print("找到水平滚动条")2
3
4
5
6
7
8
9
10
11
Getting the scroll position
Not implemented (planned): The
get_info()return keys have no scroll value field (novalue), andget_value()returns the element text (implemented asgetText), not the scroll position. Reading the scroll position is currently unavailable.
Setting the scroll position
Not implemented (planned):
set_value(number)cannot set the scroll position —set_valueis implemented as setting the element text (setText), and calling it on a ScrollBar does not change the scroll position. For scrolling, useinput.scroll(x, y, delta)instead (simulates the mouse wheel, input module).
from wingman import input
# 在指定坐标处滚动(delta 正负号为滚动方向,按平台约定)
input.scroll(500, 400, -3)2
3
4
Getting the scroll range
Not implemented (planned): The
get_info()return keys have nominimum/maximumfields. Reading the scroll range is currently unavailable.
Available Interfaces
| Python function | Lua function | Description |
|---|---|---|
find_by_name(name) | find_by_name(name) | Find by name |
| Python method | Lua method | Description |
|---|---|---|
get_info() | :get_info() | Get general information about the scroll bar |
Not implemented (planned): Reading the scroll position/range (
get_valuenumeric semantics,minimum/maximumfields) and setting it (set_valuenumeric semantics) are both not implemented —get_value/set_valueactually read/set the element text and only work for text-type controls.