Sha256: b6e9b6fbe220bb214bb19f5f03fb0b6cc3f701de453d57bf89459b7468c0e5d8

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 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}"
      end
      
      on_edited do |row, row_data| # only fires on direct table editing
        puts "Row #{row} edited: #{row_data}"
      end
    }
  }
  
  on_closing do
    puts 'Bye Bye'
  end
}.show

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-dsl-libui-0.2.10 examples/editable_table.rb
glimmer-dsl-libui-0.2.9 examples/editable_table.rb
glimmer-dsl-libui-0.2.8 examples/editable_table.rb