Sha256: f4fcce561714d2b4162c068081596df938b1b46f43040c9847c9e0f2eff6f7a7
Contents?: true
Size: 830 Bytes
Versions: 3
Compression:
Stored size: 830 Bytes
Contents
# frozen_string_literal: true class Scarpe class WebviewEditLine < WebviewWidget attr_reader :text, :width def initialize(properties) super # The JS handler sends a "change" event, which we forward to the Shoes widget tree bind("change") do |new_text| send_self_event(new_text, event_name: "change") end end def properties_changed(changes) t = changes.delete("text") if t html_element.value = t end super end def element oninput = handler_js_code("change", "this.value") HTML.render do |h| h.input(id: html_id, oninput: oninput, value: @text, style: style) end end private def style styles = {} styles[:width] = Dimensions.length(@width) if @width styles end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
lacci-0.2.1 | lib/scarpe/wv/edit_line.rb |
scarpe-0.2.1 | lib/scarpe/wv/edit_line.rb |
scarpe-0.2.0 | lib/scarpe/wv/edit_line.rb |