• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSBrowserDelegate gets passed nil matrix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSBrowserDelegate gets passed nil matrix


  • Subject: NSBrowserDelegate gets passed nil matrix
  • From: Philip White <email@hidden>
  • Date: Mon, 28 Sep 2009 08:57:59 -0500


Hello,
I'm having some problems with an NSBrowser in my application upon upgrading to Snow Leopard. The browser is a simple two column setup. I have setup the delegate as an "active delegate" to use Apple's parlance from their developer docs. So I implement
- (void)browser:(NSBrowser *)sender createRowsForColumn:(NSInteger) column inMatrix:(NSMatrix *)matrix
to create and setup the cells.
and
- (BOOL)browser:(NSBrowser *)sender isColumnValid:(NSInteger)column


Everything is good when I first choose an item in column 0. browser:createRowsForColumn: is called and everything goes well. But then if I select a different item in column 0, browser:createRowsForColumn: is called for column 1 but the third argument (the one I'm abbreviating away: inMatrix:(NSMatrix*), get's passed nil. Needless to say, that doesn't do it for me.

So the second column ends up with it's previous contents. Then, clicking on one of those items results in a: NSInternalInconsistencyException -- Invalid parameter not satisfying: cols == 1

Again, this was working in 10.5. Was I just lucky before?

Here is my code for that method, abbreviated:

- (void)browser:(NSBrowser *)sender createRowsForColumn:(NSInteger) column inMatrix:(NSMatrix *)matrix
{
if (matrix == nil)
{
NSLog(@"matrix == nil");
}

if (column == 0) //the Notebook column
{
NSInteger count = [[SBNotebookOrganizer organizers] count];

[matrix renewRows:count columns:1];
NSInteger i;

for (i=0; i<count; i++)
{

id cell = [matrix cellAtRow:i column:0];


NSString *notebookTitle;


/*
A bunch of stuff here to get the title
...

*/


[cell setTitle: notebookTitle];
[cell setLeaf:NO];

}

}
else if (column == 1)
{

//pagesView is the browser
NSString *notebookTitle = [[pagesView selectedCellInColumn:0] title];
SBNotebookOrganizer *organizer = [SBNotebookOrganizer organizerForTitle:notebookTitle];
NSInteger count = [organizer pageCount];


[matrix renewRows:count columns:1];
NSInteger i;
for (i=0; i<count; i++)
{

id cell = [matrix cellAtRow:i column:0];

NSString *title;


			//some stuff here to get the title
			...
			//			

			[cell setTitle: title];
			[cell setLeaf:YES];
		}

	}
	else
	{
		Debugger();
	}

}

Thanks!
  -Philip



_______________________________________________

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


  • Prev by Date: Re: NSView clicking through to superview
  • Next by Date: Re: NSBitmapImageRep caching behavior in Snow Leopard
  • Previous by thread: Re: Animating "contents" property of CALayer via the delegate
  • Next by thread: Why is scrollbar enabled?
  • Index(es):
    • Date
    • Thread