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 <robertpayne@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