Re: Initialising NSTableColumn ??? Continued from : Setting NSPopUpButtonCell Value from NSTable
Re: Initialising NSTableColumn ??? Continued from : Setting NSPopUpButtonCell Value from NSTable
- Subject: Re: Initialising NSTableColumn ??? Continued from : Setting NSPopUpButtonCell Value from NSTable
- From: Mike Ferris <email@hidden>
- Date: Mon, 5 Jul 2004 08:53:20 -0700
If all the rows should be popups, but the items in the popup must
differ then you actually have a second choice which might be simpler if
you haven't already got a suitable NSTableColumn subclass...
Since the cell itself can be the same (ie you don't need a text field
in some rows and popups in others, etc...) then you could just refill
the popup appropriately in an implementation of the table delegate
method:
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
This gives you a hook to configure the cell for the specific row. You
can use it to fill the popup with different items or to set the text
color of your text field or other things of that sort.
Mike
Begin forwarded message:
>
From: "Alexander F. Hartner" <email@hidden>
>
Date: July 4, 2004 11:10:10 PM PDT
>
To: Cocoa-Dev <email@hidden>
>
Cc: Chris Hanson <email@hidden>
>
Subject: Re: Initialising NSTableColumn ??? Continued from : Setting
>
NSPopUpButtonCell Value from NSTable
>
>
I tried to do this, but each row should have different elements in the
>
popup. For this to work I need a NSTableColumn which dataCellForRow
>
which returns a separate instance as from objectValueForTableColumn
>
you cannot set the values of the drop down. This is at least my
>
understanding, which might very well be incorrect.
>
>
I hope I am wrong and there is a nicer way of doing this.
>
>
Alex
>
>
>
On 04 Jul 2004, at 22:42, Chris Hanson wrote:
>
>
> It looks like you want the same menu for every pop-up button cell in
>
> your table column. If that's the case, then you don't need to
>
> override NSTableColumn or anything like that. All you need to do is
>
> configure a single NSPopUpButtonCell and set it as your
>
> NSTableColumn's dataCell. Then, in your data source, for the value
>
> of a row in that NSTableColumn just return an NSNumber containing the
>
> index of the selected item.
>
>
>
> On Jaguar and earlier, you'll have to configure and assign the
>
> NSPopUpButtonCell in an -awakeFromNib method, probably in whatever
>
> you're using as a delegate or dataSource for your NSTableView. (You
>
> can make this easier by configuring a menu in Interface Builder, and
>
> just telling the NSPopUpButtonCell to use it.) In Panther, you can
>
> attach an NSPopUpButtonCell to your NSTableColumn directly in
>
> Interface Builder and configure it entirely from the Info window.
>
>
>
> -- Chris
>
>
>
> --
>
> Chris Hanson <email@hidden>
>
> http://www.livejournal.com/users/chanson/
>
_______________________________________________
>
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.
_______________________________________________
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.