From: Eloy D. <elo...@gm...> - 2008-05-30 08:16:19
|
Ah hmm, yeah that would be hard. Can't you dump/load the actual data that the Schedule wraps? Further than that I wouldn't have a ready solution for you.... :/ Eloy On 30 mei 2008, at 10:06, Allison Newman wrote: > Oh, nothing special - classes that I had created myself. I've > included an example below. As you can see, there's noting nasty in > there. The trick is that apparently objects that are sent to the > NSOutlineView need to follow the 'protocol' NSObject, and if that's > not the case, there is an error in objc_sendMessage. > > class Schedule < NSObject > attr_accessor :name_str, :days, :dates > > def initWithName_array(name_str, days_array) > init > @name_str = name_str > @days = days_array > self > end > > def self.defaults > defaults = [] > defaults << > Schedule > .alloc.initWithName_array(Library.get_localized_string("WEEK_DAYS"), > [:monday, :tuesday, :wednesday, :thursday, :friday]) > defaults << > Schedule > .alloc.initWithName_array(Library.get_localized_string("WEEKEND"), > [:saturday, :sunday]) > defaults << > Schedule > .alloc.initWithName_array(Library.get_localized_string("EVERY_DAY"), > [:monday > , :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]) > defaults > end > > def isItemExpandable > puts "#{self} isItemExpandable" > false > end > > def getChild(index) > nil > end > > def numberOfChildren > 0 > end > > end > > On Friday, May 30, 2008, at 09:24AM, "Eloy Duran" <elo...@gm... > > wrote: >> What kind of objects that inherit from NSObject are you trying to >> save? >> >> Eloy >> >> On 30 mei 2008, at 09:13, Allison Newman wrote: >> >>> OK, I've narrowed down the problem - here's the deal. >>> >>> When the NSOutlineView calls outlineView_child_ofItem, the >>> datasource must return an object that has inherited from NSObject. >>> Apparently the object is not treated as an opaque pointer inside the >>> NSOutlineView. >>> >>> However, if you use YAML to serialise an object that inherits from >>> NSObject, when you reload the object, the NSObject part is not >>> correctly initialised. Conclusion, you can not use objects that are >>> saved using YAML in an NSOutlineView. >>> >>> Phew! That's nasty! The Ruby parts of the reloaded object work >>> just fine, it's only when you try to do something Cocoa-ish with it >>> that the problems start. >>> >>> Thanks to everyone that helped me work through this. Is this sort >>> of problem already documented somewhere? If not, maybe I could >>> write up a quick doc describing the problem, but where should I put >>> it so that others can find it? >>> >>> Alli >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2008. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Rubycocoa-talk mailing list >>> Rub...@li... >>> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Rubycocoa-talk mailing list >> Rub...@li... >> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk >> >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk |