|
From: Jonathan P. <jp...@dc...> - 2006-02-11 14:25:14
|
On 11 Feb 2006, at 9:20, Jonathan Paisley wrote:
> Passing a plain Ruby doesn't work because it gets a new (and
> therefore unique) ObjC wrapper object each time it gets passed to
> Cocoa-land. I'm not 100% sure about this -- will investigate.
The problem described above is an issue. However, even if it were
modified it doesn't really help[*].
Make your model objects - Project in your example - subclasses of
NSObject and pass them directly as items to NSOutlineView. If you
don't like having to do the 'alloc.init' dance, you can make a wrapper:
class Project < OSX::NSObject
def self.new(*args)
self.alloc.init(*args)
end
...
end
[*] NSOutlineView doesn't retain items, so the persistent objc
wrapper for the ruby object gets released but is still referenced by
NSOutlineView - boom
|