Sha256: d9abeab74b7279da0be6aa31396e662f235f8efd846a55c1b096acc05fcb7e56

Contents?: true

Size: 721 Bytes

Versions: 102

Compression:

Stored size: 721 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) {
  horizontal_box {
    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

102 entries across 102 versions & 1 rubygems

Version Path
glimmer-dsl-libui-0.11.7 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.6 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.5 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.4 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.3 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.2 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.1 examples/basic_table_button2.rb
glimmer-dsl-libui-0.11.0 examples/basic_table_button2.rb
glimmer-dsl-libui-0.10.2 examples/basic_table_button2.rb
glimmer-dsl-libui-0.10.1 examples/basic_table_button2.rb
glimmer-dsl-libui-0.10.0 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.7 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.6 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.5 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.4 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.3 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.2 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.1 examples/basic_table_button2.rb
glimmer-dsl-libui-0.9.0 examples/basic_table_button2.rb
glimmer-dsl-libui-0.8.0 examples/basic_table_button2.rb