Sha256: 5c5c41056d112e4097bfdbcaa07a528cbcb8b19c2cbbeaa6d16a60e5651487d0

Contents?: true

Size: 1.66 KB

Versions: 20

Compression:

Stored size: 1.66 KB

Contents

require_relative 'hello_computed/contact'

class HelloComputed
  include Glimmer

  def initialize
    @contact = Contact.new(
      first_name: 'Barry',
      last_name: 'McKibbin',
      year_of_birth: 1985
    )
  end

  def launch
    shell {
      text 'Hello, Computed!'
      composite {
        grid_layout {
          num_columns 2
          make_columns_equal_width true
          horizontal_spacing 20
          vertical_spacing 10
        }
        label {text 'First &Name: '}
        text {
          text bind(@contact, :first_name)
          layout_data {
            horizontal_alignment :fill
            grab_excess_horizontal_space true
          }
        }
        label {text '&Last Name: '}
        text {
          text bind(@contact, :last_name)
          layout_data {
            horizontal_alignment :fill
            grab_excess_horizontal_space true
          }
        }
        label {text '&Year of Birth: '}
        text {
          text bind(@contact, :year_of_birth)
          layout_data {
            horizontal_alignment :fill
            grab_excess_horizontal_space true
          }
        }
        label {text 'Name: '}
        label {
          text bind(@contact, :name, computed_by: [:first_name, :last_name])
          layout_data {
            horizontal_alignment :fill
            grab_excess_horizontal_space true
          }
        }
        label {text 'Age: '}
        label {
          text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
          layout_data {
            horizontal_alignment :fill
            grab_excess_horizontal_space true
          }
        }
      }
    }.open
  end
end

HelloComputed.new.launch

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
glimmer-dsl-opal-0.7.5 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.7.4 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.7.3 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.7.2 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.7.1 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.7.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.6.1 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.6.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.5.1 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.5.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.4.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.3.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-opal-0.2.0 lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.9 samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.8 samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.7 samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.6 samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.5 samples/hello/hello_computed.rb
glimmer-dsl-swt-0.6.4 samples/hello/hello_computed.rb
glimmer-dsl-opal-0.1.0 lib/samples/hello/hello_computed.rb