NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin
Hello, I have come across what seems to be a weird situation and can't really think of a good solution. I'm relatively new to Cocoa so its probably just a simple misunderstanding. I have a subclass of NSViewController that also acts as the delegate for the NSTableView that it controls.

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Keary Suska
On Jun 25, 2009, at 7:33 PM, Peter Zegelin wrote: I have come across what seems to be a weird situation and can't really think of a good solution. I'm relatively new to Cocoa so its probably just a simple misunderstanding. I have a subclass of NSViewController that also acts as the

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Graham Cox
On 26/06/2009, at 11:33 AM, Peter Zegelin wrote: I always thought awakeFromNib would get called first. But in this case not so. So can anyone suggest why, and a workaround? This sounds a bit odd, and I can't say why. But I can offer a workaround:

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 6:33 PM, Peter Zegelinpe...@fracturedsoftware.com wrote: Unfortunately my numberOfRowsInTableView is being called 'before' awakeFromNib, so initially numColumns = 0 and I get an error (myDataSize/numColumns will be infinite). So set a flag in -awakeFromNib. Check this

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin
On 26/06/2009, at 11:54 AM, Keary Suska wrote: On Jun 25, 2009, at 7:33 PM, Peter Zegelin wrote: I have come across what seems to be a weird situation and can't really think of a good solution. I'm relatively new to Cocoa so its probably just a simple misunderstanding. I have a

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin
On 26/06/2009, at 11:55 AM, Kyle Sluder wrote: On Thu, Jun 25, 2009 at 6:33 PM, Peter Zegelinpe...@fracturedsoftware.com wrote: Unfortunately my numberOfRowsInTableView is being called 'before' awakeFromNib, so initially numColumns = 0 and I get an error (myDataSize/numColumns will be

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Quincey Morris
On Jun 25, 2009, at 19:14, Peter Zegelin wrote: Well I guess the question then becomes 'where is earlier'! I tried overloading NSViewController::loadView and it also gets called 'after' the first call to numberOfRowsInTableView. If I have the 3 methods awakeFromNib, numberOfRowsInTableView

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin
On 26/06/2009, at 12:40 PM, Quincey Morris wrote: On Jun 25, 2009, at 19:14, Peter Zegelin wrote: Well I guess the question then becomes 'where is earlier'! I tried overloading NSViewController::loadView and it also gets called 'after' the first call to numberOfRowsInTableView. If I have

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Quincey Morris
On Jun 25, 2009, at 20:02, Peter Zegelin wrote: Go easy on me here - but I just have a regular NSTableView - no subclass. The NSViewController - which is subclassed -is the delegate and handles numberOfRowsInTableView/ objectValueForTableColumn. So why didn't my question make sense?

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Graham Cox
On 26/06/2009, at 1:24 PM, Quincey Morris wrote: After all, the non-band-aid way is almost as easy: I wholeheartedly agree - this was me just not taking the trouble to understand the real issue. However, in my defence I'd say that any time you perform a division by a value that

Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin
On 26/06/2009, at 1:24 PM, Quincey Morris wrote: After all, the non-band-aid way is almost as easy: - (id) initWithNibName: (NSString*) nibNameOrNil bundle: (NSBundle*) nibBundleOrNil { self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (!self)