Sha256: cbb8e395f1519be6c62e116a64ba9ec21a02243a2716448faa5b56383e29a767

Contents?: true

Size: 776 Bytes

Versions: 31

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

require 'glimmer-dsl-libui'

include Glimmer

data = [
  %w[cat meow],
  %w[dog woof],
  %w[chicken cock-a-doodle-doo],
  %w[horse neigh],
  %w[cow moo]
]

window('Editable animal sounds', 300, 200) {
  horizontal_box {
    table {
      text_column('Animal')
      text_column('Description')

      cell_rows data
      editable true
      
      on_changed do |row, type, row_data| # fires on all changes (even ones happening through data array)
        puts "Row #{row} #{type}: #{row_data}"
        $stdout.flush
      end
      
      on_edited do |row, row_data| # only fires on direct table editing
        puts "Row #{row} edited: #{row_data}"
        $stdout.flush
      end
    }
  }
  
  on_closing do
    puts 'Bye Bye'
  end
}.show

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
glimmer-dsl-libui-0.4.10 examples/editable_table.rb
glimmer-dsl-libui-0.4.9 examples/editable_table.rb
glimmer-dsl-libui-0.4.8 examples/editable_table.rb
glimmer-dsl-libui-0.4.7 examples/editable_table.rb
glimmer-dsl-libui-0.4.6 examples/editable_table.rb
glimmer-dsl-libui-0.4.5 examples/editable_table.rb
glimmer-dsl-libui-0.4.4 examples/editable_table.rb
glimmer-dsl-libui-0.4.3 examples/editable_table.rb
glimmer-dsl-libui-0.4.2 examples/editable_table.rb
glimmer-dsl-libui-0.4.1 examples/editable_table.rb
glimmer-dsl-libui-0.4.0 examples/editable_table.rb
glimmer-dsl-libui-0.3.5 examples/editable_table.rb
glimmer-dsl-libui-0.3.4 examples/editable_table.rb
glimmer-dsl-libui-0.3.3 examples/editable_table.rb
glimmer-dsl-libui-0.3.2 examples/editable_table.rb
glimmer-dsl-libui-0.3.1 examples/editable_table.rb
glimmer-dsl-libui-0.3.0 examples/editable_table.rb
glimmer-dsl-libui-0.2.24 examples/editable_table.rb
glimmer-dsl-libui-0.2.23 examples/editable_table.rb
glimmer-dsl-libui-0.2.22 examples/editable_table.rb