Sha256: 697b1cbfd9d4a26b67406abc3e76eaec98ef5c6ca9264a955fd0f97f978fbfaa

Contents?: true

Size: 668 Bytes

Versions: 11

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require 'glimmer-dsl-libui'

include Glimmer

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

window('Animal sounds', 400, 200) {
  table {
    text_column('Animal')
    text_column('Description')
    button_column('Action') {
      on_clicked do |row|
        data.delete_at(row) # automatically deletes actual table row due to implicit data-binding
      end
    }

    cell_rows data # implicit data-binding
    
    on_changed do |row, type, row_data|
      puts "Row #{row} #{type}: #{row_data}"
      $stdout.flush
    end
  }
}.show

Version data entries

11 entries across 11 versions & 1 rubygems

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