Sha256: 9feadf132e490cd1b22be454229316e624aceea40eeb9a56d175dc67c5d1e074

Contents?: true

Size: 1.69 KB

Versions: 12

Compression:

Stored size: 1.69 KB

Contents

# Copyright (c) 2020-2021 Andy Maleh
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

require 'glimmer-dsl-tk'

class Person
  attr_accessor :country, :country_options

  def initialize
    self.country_options=["", "Canada", "US", "Mexico"]
    self.country = "Canada"
  end

  def reset_country
    self.country = "Canada"
  end
end

class HelloCombobox
  include Glimmer
  
  def launch
    person = Person.new
    
    root {
      title 'Hello, Combobox!'
      
      combobox {
        state 'readonly'
        text <=> [person, :country]
      }
      
      button {
        text "Reset Selection"
        command {
          person.reset_country
        }
      }
    }.open
  end
end

HelloCombobox.new.launch

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
glimmer-dsl-tk-0.0.25 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.24 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.23 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.22 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.21 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.20 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.18 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.17 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.16 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.15 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.14 samples/hello/hello_combobox.rb
glimmer-dsl-tk-0.0.13 samples/hello/hello_combobox.rb