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

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=   value   value=  


choices  [R] 

Public Instance methods

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

Returns the value of the currently selected choice.


    # File lib/limelight/builtin/players/combo_box.rb, line 65
65:         def value
66:           return self.text
67:         end

Sets the value of the combo box. The value provided should be one choices in the combo box.


    # File lib/limelight/builtin/players/combo_box.rb, line 59
59:         def value=(text)
60:           self.text = text
61:         end