first i had this (i pass bindings in afterward):
bindings = {
name => {
:value => Proc.new { fruitapp.fruit.isa },
:value= => Proc.new { |x| fruitapp.fruit.isa = x },
:items => Proc.new { fruitapp.fruitbasket.contains },
:event_change => Proc.new { fruitapp.pickafruit }
}
}
then i thought maybe this:
mygui.bind(name, :value) { fruitapp.fruit.isa }
mygui.bind(name, :value=) { |x| fruitapp.fruit.isa = x },
mygui.bind(name, :items) { fruitapp.fruitbasket.contains },
mygui.bind(name, :event_change) { fruitapp.pickafruit }
a friend suggested this:
mygui.bind(name,
:value => Proc.new { fruitapp.fruit.isa },
:value= => Proc.new { |x| fruitapp.fruit.isa = x },
:items => Proc.new { fruitapp.fruitbasket.contains },
:event_change => Proc.new { fruitapp.pickafruit }
)
or i could do this using #missing_method
mygui.bind(name) {
value { fruitapp.fruit.isa }
value= { |x| fruitapp.fruit.isa = x }
items { fruitapp.fruitbasket.contains }
event_change { fruitapp.pickafruit }
}
which is better?
~transami
p.s. okay that'll be my last post for a while i gots to get some work
done!