class RAutomation::Adapter::Win32::ListBox

Constants

DEFAULT_LOCATORS

Default locators used for searching buttons.

Public Instance Methods

count() click to toggle source
# File lib/rautomation/adapter/win_32/list_box.rb, line 11
def count
  Functions.send_message(hwnd, Constants::LB_GETCOUNT, 0, nil)
end
Also aliased as: size
items() click to toggle source
# 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
Also aliased as: strings
select(i) click to toggle source
# 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) click to toggle source
# 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
size()
Alias for: count
strings()
Alias for: items