Skip to content

Instantly share code, notes, and snippets.

@AndyObtiva
Last active July 21, 2017 22:59
Show Gist options
  • Save AndyObtiva/884c7a204e74a15b91d3d3702926c1ad to your computer and use it in GitHub Desktop.
Save AndyObtiva/884c7a204e74a15b91d3d3702926c1ad to your computer and use it in GitHub Desktop.
HelloListSingleSelection Glimmer Example
require "glimmer"
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 HelloListSingleSelection
include Glimmer
def launch
person = Person.new
shell {
composite {
list {
selection bind(person, :country)
}
button {
text "Reset"
on_widget_selected do
person.reset_country
end
}
}
}.open
end
end
HelloListSingleSelection.new.launch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment