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:



219
220
221
222
# File 'lib/AutoItX3/control.rb', line 219

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"


214
215
216
217
# File 'lib/AutoItX3/control.rb', line 214

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

#current_selectionObject

Returns the currently selected string.



250
251
252
# File 'lib/AutoItX3/control.rb', line 250

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.



237
238
239
240
# File 'lib/AutoItX3/control.rb', line 237

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

#delete(item_number) ⇒ Object

Delete item no.



225
226
227
# File 'lib/AutoItX3/control.rb', line 225

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.



230
231
232
# File 'lib/AutoItX3/control.rb', line 230

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.



244
245
246
247
# File 'lib/AutoItX3/control.rb', line 244

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