I actually solved this. It turns out I did not set the flag "Continuously Update Value" on the binding so it would only update if you actually pressed enter.
The name/setName methods I only defined to test if they were getting called and attr_accessor actually generates these for you. -Robert On 9/02/2011, at 10:48 PM, Alan Skipp wrote: > I think if you define an accessor for 'name' with attr_accessor as you have > done with someTextField, then this should work. > You can then remove the accessor methods you have created for the 'name' > instance var. > > On 9 Feb 2011, at 08:51, Robert Payne <robertpa...@me.com> wrote: > >> Hi, >> >> I'm not sure if this is technically supposed to work in MacRuby but it >> definitely works in objective-c. >> >> class MyClass < NSWindowController >> >> attr_accessor :someTextField >> >> def name() >> return @name >> end >> >> def setName(value) >> @name = value >> end >> >> def windowDidLoad() >> @name = "Robert" >> self.someTextField.bind("value", toObject:self, >> withKeyPath:"name", options:nil) >> end >> >> end >> >> I also tried binding the text field's value directly via interface builder >> but it doesn't work there either. Interestingly if you set the "name" on the >> class inside MacRuby it'll update the text field but updating the text field >> via the GUI doesn't bring the new value back down into MacRuby. >> >> Are bindings something that have to be done with Cocoa controllers? >> >> Thanks, >> Robert Payne >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel