Class: Shoes::ListBox
- Defined in:
- lacci/lib/shoes/widgets/list_box.rb
Constant Summary
Constants included from Log
Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG
Instance Attribute Summary
Attributes inherited from Widget
Attributes inherited from Linkable
Instance Method Summary collapse
- #change(&block) ⇒ Object
-
#initialize(args = {}, &block) ⇒ ListBox
constructor
A new instance of ListBox.
Methods inherited from Widget
#banner, #caption, #destroy, display_properties, display_property, display_property_name?, display_property_names, #display_property_values, #download, dsl_name, #hide, #inscription, #inspect, #method_missing, #respond_to_missing?, #set_parent, #show, #subtitle, #tagline, #title, #toggle, widget_class_by_name
Methods included from Colors
Methods included from Log
configure_logger, #log_init, logger
Methods inherited from Linkable
#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_shoes_event
Constructor Details
#initialize(args = {}, &block) ⇒ ListBox
Returns a new instance of ListBox.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lacci/lib/shoes/widgets/list_box.rb', line 7 def initialize(args = {}, &block) @items = args[:items] || [] @selected_item = args[:selected_item] super() bind_self_event("change") do |new_item| self.selected_item = new_item @callback&.call(new_item) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shoes::Widget
Instance Method Details
#change(&block) ⇒ Object
20 21 22 23 |
# File 'lacci/lib/shoes/widgets/list_box.rb', line 20 def change(&block) @callback = block self # Allow chaining calls end |