Hi, In the same way that this tutorial (http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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
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@usherbrooke.ca>:
Hi, In the same way that this tutorial (http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
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@usherbrooke.ca>:
Hi, In the same way that this tutorial (http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
François, if you also want to see a practical use of a NSOutlineView checkout my TV app: https://github.com/mattetti/LiveTV/ - Matt 2011/12/2 François Boone <francois.boone@usherbrooke.ca>
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@usherbrooke.ca>:
Hi, In the same way that this tutorial ( http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hi, Thank you very much Matt for your great app. Not only I have learned about NSOutlineView, but I could also watch TV … :) So now, depending of which item I select in the tree, I can view information in a NSTableView. Moreover, I can change the number of column of my NSTableView depending on selected item… great. Now, I have to manage the size of each column in order that NSTableView stays inside the main window: this doesn't seem too hard Now, if I want to develop an app, I think I have to decide how to present my data, how I will store this data ( I like SQL since query language is very nice, so I will read again chapter 7 of your book). What I try to tell is I usually separate the contents of the container, and each line of code does one and only one thing. But with an interface, it's more difficult to keep these rules and I have to make trade off to manage interface and data. I will going to play with macruby and Xcode… And I will probably ask more questions. Thanks and A+ (not a rate but a french code) François Le 2011-12-02 à 19:08, Matt Aimonetti a écrit :
François, if you also want to see a practical use of a NSOutlineView checkout my TV app: https://github.com/mattetti/LiveTV/
- Matt
2011/12/2 François Boone <francois.boone@usherbrooke.ca> 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@usherbrooke.ca>:
Hi, In the same way that this tutorial (http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You probably should look into CoreData or use Sequel with sqlite3. Bonne chance et A+ - Matt 2011/12/6 François Boone <Francois.Boone@usherbrooke.ca>
Hi,
Thank you very much Matt for your great app. Not only I have learned about NSOutlineView, but I could also watch TV … :) So now, depending of which item I select in the tree, I can view information in a NSTableView. Moreover, I can change the number of column of my NSTableView depending on selected item… great. Now, I have to manage the size of each column in order that NSTableView stays inside the main window: this doesn't seem too hard
Now, if I want to develop an app, I think I have to decide how to present my data, how I will store this data ( I like SQL since query language is very nice, so I will read again chapter 7 of your book). What I try to tell is I usually separate the contents of the container, and each line of code does one and only one thing. But with an interface, it's more difficult to keep these rules and I have to make trade off to manage interface and data.
I will going to play with macruby and Xcode… And I will probably ask more questions.
Thanks and A+ (not a rate but a french code) François
Le 2011-12-02 à 19:08, Matt Aimonetti a écrit :
François, if you also want to see a practical use of a NSOutlineView checkout my TV app: https://github.com/mattetti/LiveTV/
- Matt
2011/12/2 François Boone <francois.boone@usherbrooke.ca> 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@usherbrooke.ca>:
Hi, In the same way that this tutorial ( http://developer.apple.com/library/mac/#featuredarticles/UsingMacRuby/_index...), 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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (4)
-
François Boone
-
François Boone
-
Matt Aimonetti
-
Watson