Class: Shoes::EditBox
- Defined in:
- lacci/lib/shoes/widgets/edit_box.rb
Constant Summary
Constants included from Log
Log::DEFAULT_COMPONENT, Log::DEFAULT_DEBUG_LOG_CONFIG, Log::DEFAULT_LOG_CONFIG
Instance Attribute Summary
Attributes inherited from Widget
Attributes inherited from Linkable
Instance Method Summary collapse
- #append(new_text) ⇒ Object
- #change(&block) ⇒ Object
-
#initialize(text = "", height: nil, width: nil, &block) ⇒ EditBox
constructor
A new instance of EditBox.
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(text = "", height: nil, width: nil, &block) ⇒ EditBox
Returns a new instance of EditBox.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lacci/lib/shoes/widgets/edit_box.rb', line 7 def initialize(text = "", height: nil, width: nil, &block) @text = text @callback = block super bind_self_event("change") do |new_text| self.text = new_text @callback&.call(self) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shoes::Widget
Instance Method Details
#append(new_text) ⇒ Object
25 26 27 |
# File 'lacci/lib/shoes/widgets/edit_box.rb', line 25 def append(new_text) self.text = self.text + new_text end |
#change(&block) ⇒ Object
21 22 23 |
# File 'lacci/lib/shoes/widgets/edit_box.rb', line 21 def change(&block) @callback = block end |