Class: AutoItX3::ListBox

Inherits:
Control show all
Defined in:
lib/AutoItX3/control.rb

Overview

List boxes are controls in which you can select one or multiple items by clicking on it. ListBox is also the superclass of ComboBox.

Direct Known Subclasses

ComboBox

Instance Method Summary collapse

Methods inherited from Control

#click, #disable, #enable, #enabled?, #focus, from_control, functions, functions=, #handle, #hide, #initialize, #move, #rect, #send_command_to_control, #send_keys, #show, #text, #text=, #visible?

Constructor Details

This class inherits a constructor from AutoItX3::Control

Instance Method Details

#<<(string) ⇒ Object

:nodoc:



221
222
223
224
# File 'lib/AutoItX3/control.rb', line 221

def <<(string) # :nodoc:
  add_item(string)
  self
end

#add_item(string) ⇒ Object

call-seq:

AutoItX3::ListBox#add( item ) ==> item
AutoItX3::ListBox#<< item ==> self

Adds an entry to an existing combo or list box. If you use the << form, you can do a chain call like:

ctrl << "a" << "b" << "c"


216
217
218
219
# File 'lib/AutoItX3/control.rb', line 216

def add_item(string)
  send_command_to_control("AddString", string)
  string
end

#current_selectionObject

Returns the currently selected string.



252
253
254
# File 'lib/AutoItX3/control.rb', line 252

def current_selection
  send_command_to_control("GetCurrentSelection")
end

#current_selection=(num) ⇒ Object

Sets the current selection of a combo box to item num. The index is zero-based. Raises an Au3Error if num is out of range.



239
240
241
242
# File 'lib/AutoItX3/control.rb', line 239

def current_selection=(num)
  send_command_to_control("SetCurrentSelection", num.to_i)
  num
end

#delete(item_number) ⇒ Object

Delete item no.



227
228
229
# File 'lib/AutoItX3/control.rb', line 227

def delete(item_number)
  send_command_to_control("DelString", item.to_s).to_i
end

#find(item) ⇒ Object

Finds the item number of item in self.



232
233
234
# File 'lib/AutoItX3/control.rb', line 232

def find(item)
  send_command_to_control("FindString", item).to_i
end

#select_string(str) ⇒ Object

Sets self‘s selection to the first occurence of str. Raises an Au3Error if str cannot be found.



246
247
248
249
# File 'lib/AutoItX3/control.rb', line 246

def select_string(str)
  send_command_to_control("SelectString", str)
  string
end