Re: reading selectedItem from within dataCellForRow?
Re: reading selectedItem from within dataCellForRow?
- Subject: Re: reading selectedItem from within dataCellForRow?
- From: Yann Bizeul <email@hidden>
- Date: Tue, 5 Jun 2007 08:18:15 +0200
Woops, I did not read your code right.
It seems you're doping the right thing
Sorry !
Yann Bizeul - yann at tynsoe.org
Cocoa Developer
Tynsoe Projects
BuddyPop - GeekTool - SSH Tunnel Manager - ...
http://projects.tynsoe.org/
Le 5 juin 07 à 04:44, William Zumwalt a écrit :
I have a class subclassed from NSTableColumn which overrides
dataCellForRow: like what's listed below.
My problem is that I want to build the next NSPopUpButtonCell pending
upon the selection of the top NSPopUpButtonCell. So if popupButtonCell
on row 0 has item A selected, then popupButtonCell on row 1 should
only contain and show 2 items (A-B), otherwise, it might list items
A-C.
But I don't know how to make that decision from within this method
because I can't seem to get a handle on the data from here.
- (id) dataCellForRow:(int) row
{
id textCell = [super dataCellForRow:row];
NSPopUpButtonCell *pubCell;
if (row == 0 || row == 1) {
pubCell = [[NSPopUpButtonCell alloc] init];
[pubCell setBordered:NO];
[pubCell setPullsDown:NO];
[pubCell setFont:[NSFont labelFontOfSize:[NSFont
smallSystemFontSize]]];
[pubCell setControlSize:NSMiniControlSize];
[pubCell setAlignment:NSLeftTextAlignment];
[pubCell setEditable:YES];
}
if (row == 0) {
[pubCell addItemWithTitle:@"selection A"];
[pubCell addItemWithTitle:@"selection B"];
}
else if (row == 1) {
// if "selection A" in row 0 has A selected, then I list 2 items.
[pubCell addItemWithTitle:@"selection A"];
[pubCell addItemWithTitle:@"selection B"];
// otherwise, I might list all 3 items if I could see
// what is selected from here.
[pubCell addItemWithTitle:@"selection C"];
}
else if (row == 2) {
[textCell setEditable:NO];
[textCell setTextColor:[NSColor blackColor]];
}
if (row == 0 || row == 1) {
// these rows are popupButtonCell's
return pubCell;
}
// all other rows are NSTextFieldCell's
return textCell;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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