Class: TkComponent::Builder::TkItemWithVariable
- Includes:
- ValueTyping
- Defined in:
- lib/tk_component/builder/tk_item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#tk_variable ⇒ Object
Returns the value of attribute tk_variable.
Attributes inherited from TkItem
Instance Method Summary collapse
- #apply_variable ⇒ Object
- #create_variable ⇒ Object
-
#initialize(parent_item, name, options = {}, grid = {}, event_handlers = []) ⇒ TkItemWithVariable
constructor
A new instance of TkItemWithVariable.
- #variable_name ⇒ Object
Methods included from ValueTyping
#apply_option, #f_value, #i_value, #s_value, #update_value
Methods inherited from TkItem
#apply_internal_grid, #apply_option, #apply_options, #built, create, #create_native_item, #focus, #native_item_class, #remove, #set_event_handler, #set_event_handlers, #set_grid
Constructor Details
#initialize(parent_item, name, options = {}, grid = {}, event_handlers = []) ⇒ TkItemWithVariable
Returns a new instance of TkItemWithVariable.
108 109 110 111 112 |
# File 'lib/tk_component/builder/tk_item.rb', line 108 def initialize(parent_item, name, = {}, grid = {}, event_handlers = []) create_variable super apply_variable end |
Instance Attribute Details
#tk_variable ⇒ Object
Returns the value of attribute tk_variable.
106 107 108 |
# File 'lib/tk_component/builder/tk_item.rb', line 106 def tk_variable @tk_variable end |
Instance Method Details
#apply_variable ⇒ Object
118 119 120 |
# File 'lib/tk_component/builder/tk_item.rb', line 118 def apply_variable self.native_item&.public_send(variable_name, @tk_variable) end |
#create_variable ⇒ Object
122 123 124 |
# File 'lib/tk_component/builder/tk_item.rb', line 122 def create_variable @tk_variable = TkVariable.new end |
#variable_name ⇒ Object
114 115 116 |
# File 'lib/tk_component/builder/tk_item.rb', line 114 def variable_name :variable end |