Sha256: e36f9e623eaa49e016274f9198dbe93d033bc6e5bce523a4c41198a8849252ed

Contents?: true

Size: 1.04 KB

Versions: 23

Compression:

Stored size: 1.04 KB

Contents

module RAutomation
  module Adapter
    module Win32
      class ListBox < Control
        include WaitHelper
        include Locators

        # Default locators used for searching buttons.
        DEFAULT_LOCATORS = {:class => /listbox/i}

        def count
          Functions.send_message(hwnd, Constants::LB_GETCOUNT, 0, nil)
        end

        alias_method :size, :count

        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

        alias_method :strings, :items

        def selected?(i)
          Functions.send_message(hwnd, Constants::LB_GETSEL, i, nil) > 0
        end

        def select(i)
          Functions.send_message(hwnd, Constants::LB_SETCURSEL, i, nil)
        end

      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rautomation-2.0.1-x86-mingw32 lib/rautomation/adapter/win_32/list_box.rb
rautomation-2.0.1-x64-mingw32 lib/rautomation/adapter/win_32/list_box.rb
rautomation-1.1.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-1.0.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.17.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.16.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.15.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.14.1 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.14.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.13.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.12.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.11.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.10.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.9.4 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.9.3 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.9.2 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.9.1 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.9.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.8.0 lib/rautomation/adapter/win_32/list_box.rb
rautomation-0.7.3 lib/rautomation/adapter/win_32/list_box.rb