class RAutomation::Adapter::Win32::SelectList

Constants

DEFAULT_LOCATORS

Default locators used for searching buttons.

Public Instance Methods

dropbox_boundary() click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 76
def dropbox_boundary
  boundary = FFI::MemoryPointer.new :long, 4

  Functions.send_message(hwnd, Constants::CB_GETDROPPEDCONTROLRECT, 0 ,boundary)

  boundary.read_array_of_long(4)
end
get_top_index() click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 84
def get_top_index
  Functions.send_message(hwnd, Constants::CB_GETTOPINDEX, 0 ,nil)
end
list_item_height() click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 72
def list_item_height
  Functions.send_message(hwnd, Constants::CB_GETITEMHEIGHT, 0 ,nil)
end
option(options) click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 55
def option(options)
  item_count.times do |item_no|
    item = Functions.retrieve_combobox_item_text(hwnd, item_no)
    return SelectListOption.new(self, item, item_no) if options[:text] == item
  end

  nil
end
options(options = {}) click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 34
def options(options = {})
  items = []

  item_count.times do |item_no|
    item = Functions.retrieve_combobox_item_text(hwnd, item_no)

    if options[:text]
      items.push(SelectListOption.new(self, item, item_no)) if options[:text] == item
    else
      items.push(SelectListOption.new(self, item, item_no))
    end
  end

  items
end
select(index) click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 64
def select(index)
  Functions.send_message(hwnd, Constants::CB_SETCURSEL, index, nil) != Constants::CB_ERR
end
set(text) click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 68
def set(text)
  option(:text => text).set
end
value() click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 50
def value
  selected_option = options.find { |option| option.selected? }
  selected_option ? selected_option.text : ""
end

Private Instance Methods

item_count() click to toggle source
# File lib/rautomation/adapter/win_32/select_list.rb, line 90
def item_count
  Functions.send_message(hwnd, Constants::CB_GETCOUNT, 0, nil)
end