examples/form_table4.rb in glimmer-dsl-libui-0.4.14 vs examples/form_table4.rb in glimmer-dsl-libui-0.4.15

- old
+ new

@@ -14,11 +14,11 @@ ['Melody Hanheimer', 'melody@hanheimer.com', '213-493-8274', 'Los Angeles', 'CA'], ] end def launch - window('Contacts', 600, 600) { |w| + window('Contacts', 600, 600) { margined true vertical_box { form { stretchy false @@ -52,12 +52,12 @@ button('Save Contact') { stretchy false on_clicked do new_row = [name, email, phone, city, state] - if new_row.include?('') - msg_box_error(w, 'Validation Error!', 'All fields are required! Please make sure to enter a value for all fields.') + if new_row.map(&:to_s).include?('') + msg_box_error('Validation Error!', 'All fields are required! Please make sure to enter a value for all fields.') else data << new_row # automatically inserts a row into the table due to implicit data-binding @unfiltered_data = data.dup self.name = '' # automatically clears name entry through explicit data-binding self.email = '' @@ -98,9 +98,15 @@ editable true cell_rows <=> [self, :data] # explicit data-binding to raw data Array of Arrays on_changed do |row, type, row_data| puts "Row #{row} #{type}: #{row_data}" + $stdout.flush # for Windows + end + + on_edited do |row, row_data| # only fires on direct table editing + puts "Row #{row} edited: #{row_data}" + $stdout.flush # for Windows end } } }.show end