Class: Scarpe::Webview::ListBox

Inherits:
Drawable show all
Defined in:
lib/scarpe/wv/list_box.rb

Constant Summary

Constants included from Shoes::Log

Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG

Instance Attribute Summary collapse

Attributes inherited from Drawable

#children, #parent, #shoes_linkable_id

Attributes inherited from Shoes::Linkable

#linkable_id

Instance Method Summary collapse

Methods inherited from Drawable

#add_child, #bind, #destroy_self, display_class_for, #full_window_redraw!, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #remove_child, #set_parent, #shoes_styles, #to_html

Methods included from Shoes::Log

configure_logger, #log_init, logger

Methods inherited from Shoes::Linkable

#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_all_shoes_events, #unsub_shoes_event

Constructor Details

#initialize(properties) ⇒ ListBox

Returns a new instance of ListBox.



7
8
9
10
11
12
13
# File 'lib/scarpe/wv/list_box.rb', line 7

def initialize(properties)
  super

  bind("change") do |new_item|
    send_self_event(new_item, event_name: "change")
  end
end

Instance Attribute Details

#chosenObject (readonly)

Returns the value of attribute chosen.



5
6
7
# File 'lib/scarpe/wv/list_box.rb', line 5

def chosen
  @chosen
end

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/scarpe/wv/list_box.rb', line 5

def height
  @height
end

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/scarpe/wv/list_box.rb', line 5

def items
  @items
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/scarpe/wv/list_box.rb', line 5

def width
  @width
end

Instance Method Details

#elementObject



23
24
25
# File 'lib/scarpe/wv/list_box.rb', line 23

def element
  render("list_box")
end

#properties_changed(changes) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/scarpe/wv/list_box.rb', line 15

def properties_changed(changes)
  selected = changes.delete("chosen")
  if selected
    html_element.value = selected
  end
  super
end