Class: RAutomation::Adapter::WinFfi::Table
Instance Method Summary
collapse
Methods inherited from Control
#assert_enabled, #click, #disabled?, #enabled?, #exist?, #has_focus?, #initialize, #matches_type, #set_focus, #uia_control
Instance Method Details
#row_count
43
44
45
|
# File 'lib/rautomation/adapter/win_ffi/table.rb', line 43
def row_count
UiaDll::find_children(uia_control(@locators[:id]), nil)
end
|
#select(row)
34
35
36
|
# File 'lib/rautomation/adapter/win_ffi/table.rb', line 34
def select(row)
Functions.select_table_row(Window.oleacc_module_handle, Functions.control_hwnd(@window.hwnd, @locators), row)
end
|
#selected?(row) ⇒ Boolean
38
39
40
41
|
# File 'lib/rautomation/adapter/win_ffi/table.rb', line 38
def selected?(row)
state = Functions.get_table_row_state(Window.oleacc_module_handle, Functions.control_hwnd(@window.hwnd, @locators), row)
state & Constants::STATE_SYSTEM_SELECTED != 0
end
|
#strings
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rautomation/adapter/win_ffi/table.rb', line 8
def strings
rows = []
header_columns = []
raise "Not a list control" unless UiaDll::current_control_type(uia_control(@locators[:id])) == Constants::UIA_LIST_CONTROL_TYPE
children_count = count_children(uia_control(@locators[:id]))
children = FFI::MemoryPointer.new :pointer, children_count
UiaDll::find_children(uia_control(@locators[:id]), children)
children.read_array_of_pointer(children_count).each do |child|
grandchildren_count = count_children(child)
grandchildren = FFI::MemoryPointer.new :pointer, grandchildren_count
UiaDll::find_children(child, grandchildren)
grandchildren.read_array_of_pointer(grandchildren_count).each do |grandchild|
grandchild_name = FFI::MemoryPointer.new :char, UiaDll::get_name(grandchild, nil) + 1
UiaDll::get_name(grandchild, grandchild_name)
header_columns.push grandchild_name.read_string
end
rows.push header_columns
header_columns = []
end
rows
end
|