Dear Cristian:
> I'm fairly new to Cappuccino world, but I have a strong background in C-like programming language.
> I'm having trouble understanding how binding works in Cappuccino …
It is much easier. Unter @implementation in the AppController or a separate class, declare:
CPString l1roundString @accessors; // sorry it has this strange name :)
// the @accessors is the magic for binding
later, when you want to change its values, use “set…” like so:
[self setL1roundString: [CPString stringWithFormat: @"%i%%", Math.round(100 * l1 / l2)]];
// note the use of a capital after “set”
// need to use “set” to make the binding actually work its magic
// this would not work: l1roundString = some string value
and in Xcode>Resources>MainMenu.xib do this:
select the textfield
do View>Utilities>Show Bindings Inspector
in the “value” field tick “Bind to” Delegate
in Model Key Path type
otView.l1roundString // I declared it in a class “otView” separate from AppController, OR just
l1roundString // if it’s declared in the AppController
That’s all! No dictionary necessary. You can find my example running here
http://michaelbach.de/ot/sze-tIllusion/
[you need to adjust the vertical blue line, then the button “show result” becomes enabled, clicking it changes the textbox under it via the “set…” command above.]
Welcome to Cappuccino, best, Michael
--
Prof. Michael Bach PhD, Eye Center, University of Freiburg, Killianstr. 5, 79106 Freiburg, Germany.
Michae...@uni-freiburg.de <
http://michaelbach.de>