In examples/fwt/demo.fan, there is this piece of code (shortened)
Widget makeWindow()
{
mode := Combo { items = WindowMode.vals; editable=false }
open := |->|
{
close := Button { text="Close Me" }
w := Window(mode.window)
{
it.mode = mode.selected
}
w.open
}
}
Now the thing that I don't get is that in the itBlock of the window you have it.mode which according to the itBlock doc page could be written simply as mode (it optional), yet it also references mode.selected which apparently is the mode of Combo.
So that's kindof like having 2 vars with the same name in the scope which is difficult to deal with.
What is the way this is deal with ... is it that if an "inner" itblock var can NOT replace the one in an outer itBlock then ?
tcolarTue 6 Apr 2010
nevermind I see now how it binds only if it doesn't exist in the local scope yet.
tcolar Tue 6 Apr 2010
In examples/fwt/demo.fan, there is this piece of code (shortened)
Now the thing that I don't get is that in the itBlock of the window you have
it.mode
which according to the itBlock doc page could be written simply asmode
(it optional), yet it also referencesmode.selected
which apparently is the mode of Combo.So that's kindof like having 2 vars with the same name in the scope which is difficult to deal with.
What is the way this is deal with ... is it that if an "inner" itblock var can NOT replace the one in an outer itBlock then ?
tcolar Tue 6 Apr 2010
nevermind I see now how it binds only if it doesn't exist in the local scope yet.