Sha256: 75ba444dae67a502dd42628be056fd21af25a5c1141cd7fd9b99fcf4f9e2573e
Contents?: true
Size: 716 Bytes
Versions: 19
Compression:
Stored size: 716 Bytes
Contents
require 'glimmer-dsl-libui' class Counter attr_accessor :count def initialize self.count = 0 end end class ButtonCounter include Glimmer::LibUI::Application before_body do @counter = Counter.new end body { window('Hello, Button!', 190, 20) { vertical_box { button { # data-bind button text to @counter count, converting to string on read from model. text <= [@counter, :count, on_read: ->(count) {"Count: #{count}"}] on_clicked do # This change will automatically propagate to button text through data-binding above @counter.count += 1 end } } } } end ButtonCounter.launch
Version data entries
19 entries across 19 versions & 1 rubygems