Class: RAutomation::Adapter::Win32::ListBox
Constant Summary
collapse
- DEFAULT_LOCATORS =
Default locators used for searching buttons.
{:class => /listbox/i}
Instance Method Summary
collapse
Methods inherited from Control
#class_name, #click, #disabled?, #enabled?, #exist?, #focus, #focused?, #hwnd, #initialize, #value
Instance Method Details
#count
Also known as:
size
11
12
13
|
# File 'lib/rautomation/adapter/win_32/list_box.rb', line 11
def count
Functions.send_message(hwnd, Constants::LB_GETCOUNT, 0, nil)
end
|
#items
Also known as:
strings
17
18
19
20
21
22
23
24
|
# File 'lib/rautomation/adapter/win_32/list_box.rb', line 17
def items
count.times.reduce([]) do |memo, i|
text_length = Functions.send_message(hwnd, Constants::LB_GETTEXTLEN, 0, nil) + 1
text = FFI::MemoryPointer.new :char, text_length
Functions.send_message(hwnd, Constants::LB_GETTEXT, i, text)
memo << text.read_string
end
end
|
#select(i)
32
33
34
|
# File 'lib/rautomation/adapter/win_32/list_box.rb', line 32
def select(i)
Functions.send_message(hwnd, Constants::LB_SETCURSEL, i, nil)
end
|
#selected?(i) ⇒ Boolean
28
29
30
|
# File 'lib/rautomation/adapter/win_32/list_box.rb', line 28
def selected?(i)
Functions.send_message(hwnd, Constants::LB_GETSEL, i, nil) > 0
end
|