Sha256: 9fc62150f7626434ec03aa104dd35d377c0c512d627f5e37d24249f65517b8d8

Contents?: true

Size: 842 Bytes

Versions: 9

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require 'glimmer-dsl-libui'

include Glimmer

data = [
  ['cat', 'meow', [true, 'mammal']],
  ['dog', 'woof', [true, 'mammal']],
  ['chicken', 'cock-a-doodle-doo', [false, 'mammal']],
  ['horse', 'neigh', [true, 'mammal']],
  ['cow', 'moo', [true, 'mammal']]
]

window('Animal sounds', 400, 200) {
  table {
    text_column('Animal')
    text_column('Sound')
    checkbox_text_column('Description') {
      editable true
    }

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
glimmer-dsl-libui-0.12.5 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.12.4 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.12.3 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.12.2 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.12.1 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.12.0 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.11.10 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.11.9 examples/basic_table_checkbox_text.rb
glimmer-dsl-libui-0.11.8 examples/basic_table_checkbox_text.rb