Module | Limelight::Builtin::Players::ComboBox |
In: |
lib/limelight/builtin/players/combo_box.rb
|
A Builtin Player that adds the look and behavior of a native combo box. It may be applied in the PropBuilder DSL like so:
my_button :players => "combo_box"
Props including this Player must not override the mouse_pressed event.
Props including this Player may implement an additional hook:
def value_changed(e) # do something end
Props including this Player may implement any of the key and focus event hooks:
key_pressed, key_typed, key_released, focus_gained, focus_lost
choices | [R] |
Sets the choices listed in the combo_box. The value parameter should an Array or a String that can be evalulated into an Array. All choices in a combo_box are strings.
combo_box.choices = ["one", "two", "three"] combo_box.choices = "[‘one’, ‘two’, ‘three’]"
# File lib/limelight/builtin/players/combo_box.rb, line 49 49: def choices=(value) 50: value = eval(value) if value.is_a? String 51: raise "Invalid choices type: #{value.class}. Choices have to be an array." if !value.is_a?(Array) 52: @choices = value 53: combo_box.remove_all_items 54: value.each { |choice| combo_box.add_item(choice) } 55: end