Sha256: bb7f81e068be5c7ee583afd0a98c60b3c2083e8d4df2d71772e1f5fc12e5a59c

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 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', 300, 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}"
      end
    }
  }
}.show

Version data entries

3 entries across 3 versions & 1 rubygems

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