Re: NSBrowser matrix
Re: NSBrowser matrix
- Subject: Re: NSBrowser matrix
- From: Ari Black <email@hidden>
- Date: Sun, 26 Jun 2011 07:18:34 -0400
On 11-06-26 7:04 AM, Fritz Anderson wrote:
On 25 Jun 2011, at 7:05 PM, Ari Black wrote:
@implementation SpecialMatrix
- (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows numberOfColumns:(NSInteger)numColumns {
int x;
x = 0; // I put a breakpoint here
return self;
}
@end
You don't get to this point, so it's not the problem you have now, but I assume your real code invokes [super initWithFrame:...]?
I hadn't put a call to [super ...] yet as I wanted to verify that my
initWithFrame: was being called. Once I get this problem worked out, I
will call [super ...].
This is in the implementation of the class that controls the window the browser is in:
- (void)awakeFromNib {
[browser setMatrixClass:[SpecialMatrix class]];
[browser loadColumnZero];
NSMatrix *matrix = [storyLine matrixInColumn:0]; //<- return nil
matrix = [storyLine matrixInColumn:1]; //<- returns nil
}
First step: Break in -awakeFromNib and verify that browser is not nil.
I've tested this and it's not nil. browser is an outlet I created and
connected with IB. The NSBrowser works for adding items to all of the
columns and I check to make sure that SpecialMatrix is set to be the
matrix class in browser after the call to setMatrixClass:
Second step: Maybe an NSBrowser doesn't instantiate any matrices until you have responded to browser:numberOfRowsInColumn: with a non-zero value?
— F
That's possible, but I've tested adding items to the columns and
SpecialMatrix's initWith...: doesn't get called.
I do want to point out that I'm implementing
browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does
that make a difference?
Thanks!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden