Re: NSMatrix - No new NSCells need apply
Re: NSMatrix - No new NSCells need apply
- Subject: Re: NSMatrix - No new NSCells need apply
- From: "Louis C. Sacha" <email@hidden>
- Date: Sun, 9 May 2004 14:55:56 -0700
Hello...
Well, NSMatrix uses a 0 based index, like NSArray, so in a matrix
with one column there is no column with index 1 (and therefore no
cells in that column), just a column with index 0.
So your code should probably look like:
for(dex = 0; dex < rows; dex++)
{
NSButtonCell* newbutton = [[[NSButtonCell alloc] init] retain];
[newbutton setButtonType:NSRadioButton];
[newbutton setTitle:(NSString*)num2cfstr(dex+1)];
testcell = [mat cellAtRow:dex column:0]; // NULL is expected
[mat putCell:newbutton atRow:dex column:0];
testcell = [mat cellAtRow:dex column:0]; // unexpected NULL
}
This might fix the other problem you mentioned as well, if it
happens to be some sort of side effect of how you are entering the
cells.
Hope that helps,
Louis
The Problem:
------------
Programatically created instances of NSMatrix to not behave as I
would expect. Cells added to an NSMatrix object, already configured
with 'n' rows and 1 column, are not returned by 'cellAtRow:column'
...
for(dex = 1; dex <= rows; dex++)
{
NSButtonCell* newbutton = [[[NSButtonCell alloc] init] retain];
[newbutton setButtonType:NSRadioButton];
[newbutton setTitle:(NSString*)num2cfstr(dex)];
testcell = [mat cellAtRow:dex column:1]; // NULL is expected
[mat putCell:newbutton atRow:dex column:1];
testcell = [mat cellAtRow:dex column:1]; // unexpected NULL
}
// -------------------------------------------------------------------
...
Also - one exciting thing I found was that NSMatrix puts cell #1
at the BOTTOM of the frame and the last cell entered is placed at
the top of the frame. This makes for some excitement if you are
entering an ascending-list as you get a descending-list result.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.