Sunday, November 30, 2008

Glimmer List Box Multi-Selection Data-Binding

I added data-binding support for multi-selection List boxes.


class Person
attr_accessor :provinces, :provinces_options

def initialize
self.provinces_options=[
"",
"Quebec",
"Ontario",
"Manitoba",
"Saskatchewan",
"Alberta",
"British Columbia",
"Nova Skotia",
"Newfoundland"
]
self.provinces = ["Quebec", "Manitoba", "Alberta"]
end
end

class HelloMultiSelectList
include Glimmer
def launch
shell {
list(:multi) {
selection bind(Person.new, :provinces)
}
}.open
end
end

HelloMultiSelectList.new.launch


This produces a tiny shell with a multi-selection list box that has "Quebec", "Manitoba", and "Alberta" preselected:



Stay tuned for simplified tab syntax next!

No comments: