[MacRuby-devel] ruby structure for NSOutlineView
François Boone
francois.boone at usherbrooke.ca
Fri Dec 2 08:57:07 PST 2011
Hi,
Thank you very much for these links.
I tried them and they worked more or less … since I used Xcode 3
But I decide to upgrade my computer and now I have Lion and Xcode 4
So I can continue my learnings.
François
Le 2011-11-26 à 16:22, Watson a écrit :
> Hi,
>
> My samples might help you slightly.
> - https://github.com/Watson1978/MacRuby-Samples/tree/master/SourceList
> - https://github.com/Watson1978/MacRuby-Samples/tree/master/SourceList2
> - https://github.com/Watson1978/MacRuby-Samples/tree/master/SourceListBinding
>
> enjoy! :)
>
> 2011/11/27 François Boone <francois.boone at usherbrooke.ca>:
>> Hi,
>> In the same way that this tutorial (http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index.html), I try to implement a NSOutlineView controller in ruby to make a simple tree in the left part of a window.
>> I read the documentation of NSOutlineView, tasks and I understand I have to write at least four methods in my controller class:
>> • – outlineView:child:ofItem:
>> • – outlineView:isItemExpandable:
>> • – outlineView:numberOfChildrenOfItem:
>> • – outlineView:objectValueForTableColumn:byItem:
>> My questions are:
>> 1) what kind of object I have to use in ruby to fit with outlineView structure?
>> If I understand I need a structure like:
>> Parent_1 : child 1, child 2
>> Parent_2 : no child
>> Parent_3 : child 1, child 2, child 3
>> 2) Is a Hash like this:
>> Hash[ "Parent_1" => ["child 1", child 2"], "Parent_2", Parent_3 => ["child 1", "child 2", "child_3"]]
>> can be the solution?
>> 3) where I can find this kind of information: the mapping between ruby data structure and NSObject data structure (for future use)?
>> 4) and the last one: I think I do not understand what is item in the last method:
>> – outlineView:objectValueForTableColumn:byItem:
>> item: An item in the data source in the specified tableColumn of the view.
>> So, if I want to make a simple tree, I should have just one column, and then item should be Parent_x or child_x: Is it right?
>>
>> Thank you for reply
>> François
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
More information about the MacRuby-devel
mailing list