[MacRuby-devel] Cocoa Bindings not writing?

Robert Payne robertpayne at me.com
Wed Feb 9 00:51:53 PST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110209/8972e7cf/attachment.html>


More information about the MacRuby-devel mailing list