Re: Best data source for table view in document window

2012-09-06 Thread Jerry Krinock
On 2012 Sep 05, at 21:13, Martin Hewitson martin.hewit...@aei.mpg.de wrote: I already had a -cleanUp method being called from -windowWillClose: within the NSDocument I just checked my code again and found that I am already using -windowWillClose: as suggested by Graham, for the stuff in the

Re: Best data source for table view in document window

2012-09-06 Thread Graham Cox
On 07/09/2012, at 4:36 AM, Jerry Krinock je...@ieee.org wrote: But I'm still using my other triggers because sometimes my document opens with no windows Don't forget also that Cocoa will be creating instances of your document at all sorts of odd times with Autosave and Versions in play.

Best data source for table view in document window

2012-09-05 Thread Jerry Krinock
What is the best the data source for a table view in a document window? The candidates are… (1) Category of the document. This is the way it is done in the WithoutBindings (With and Without Bindings) Apple sample code. But it seems like too much view-ish code in the data model,

Re: Best data source for table view in document window

2012-09-05 Thread Alex Zavatone
I use a standalone singleton object in Matt Galloway style. Never ran into the crash you're mentioning. On Sep 5, 2012, at 8:39 AM, Jerry Krinock wrote: What is the best the data source for a table view in a document window? The candidates are… (1) Category of the document. This is

Re: Best data source for table view in document window

2012-09-05 Thread Gary L. Wade
If the table view's data is related to the document, you should keep this in the document. Putting it in a category when the class is fully under your control seems a bit odd, but you may have a reason for that. You should look at your reservations, though. You're wanting to hook up a data

Re: Best data source for table view in document window

2012-09-05 Thread Kyle Sluder
On Sep 5, 2012, at 5:39 AM, Jerry Krinock je...@ieee.org wrote: What is the best the data source for a table view in a document window? The candidates are… (1) Category of the document. This is the way it is done in the WithoutBindings (With and Without Bindings) Apple sample code.

Re: Best data source for table view in document window

2012-09-05 Thread Martin Hewitson
(2) Separate, standalone object. Fancy housekeeping is needed to avoid retain cycles, and crashes in corner cases as the document window is closing. Quite common. This kind of life cycle management is part of living with Cocoa. Consider making this object an NSViewController

Re: Best data source for table view in document window

2012-09-05 Thread Seth Willits
On Sep 5, 2012, at 5:39 AM, Jerry Krinock wrote: … except that my window controller for this multi-tabbed window is already huge. In a complex window where there a multiple tabbed views like you have, think of the window controller as doing nothing more than managing the view controllers

Re: Best data source for table view in document window

2012-09-05 Thread Chris Hanson
On Sep 5, 2012, at 5:39 AM, Jerry Krinock je...@ieee.org wrote: (2) Separate, standalone object. Fancy housekeeping is needed to avoid retain cycles, and crashes in corner cases as the document window is closing. This is the way to go. That housekeeping doesn’t need to be so fancy; you just

Re: Best data source for table view in document window

2012-09-05 Thread Chris Hanson
On Sep 5, 2012, at 11:53 AM, Seth Willits sli...@araelium.com wrote: In a complex window where there a multiple tabbed views like you have, think of the window controller as doing nothing more than managing the view controllers for each of the tabs, not the actual views in each tab. If your

Re: Best data source for table view in document window

2012-09-05 Thread Andy Lee
On Sep 5, 2012, at 11:24 AM, Kyle Sluder k...@ksluder.com wrote: On Sep 5, 2012, at 5:39 AM, Jerry Krinock je...@ieee.org wrote: What is the best the data source for a table view in a document window? The candidates are… (1) Category of the document. This is the way it is done in the

Re: Best data source for table view in document window

2012-09-05 Thread Jerry Krinock
I'm still digesting all the fine advice in this thread. But since it seems like I'm going to keep my standalone data source in some form, here is a quick answer to Martin's question regarding crashes. On 2012 Sep 05, at 10:16, Martin Hewitson martin.hewit...@aei.mpg.de wrote: occasional

Re: Best data source for table view in document window

2012-09-05 Thread Graham Cox
On 06/09/2012, at 10:44 AM, Jerry Krinock je...@ieee.org wrote: Regarding the indication, I've yet to find a single hook in Cocoa which gives me a reliable early warning that a document is closing. If your document only has a single window, you could use: - (void)

Re: Best data source for table view in document window

2012-09-05 Thread Martin Hewitson
Thanks for the advice, gentlemen. I already had a -cleanUp method being called from -windowWillClose: within the NSDocument (NSPersistentDocument, actually), so I looked more carefully at how that particular view controller is torn down. I made some changes such that now, in the document's