Re: Object from TableView cell
Re: Object from TableView cell
- Subject: Re: Object from TableView cell
- From: Phillip Morelock <email@hidden>
- Date: Fri, 14 Jun 2002 07:20:05 -0700
>
> What I don't know is how to get the name of the object cell,
>
> because the
>
> cell is situated in a table and I do not have an instance of the cells.
>
>
>
It's possible I'm missing something in these exchanges, but in general
>
you certainly do have access to the cells in a tableview -- as has been
>
mentioned several times in the last month or two...
>
For any table column in a tableview, you can get, or set, its dataCell...
>
>
mmalc
Hi, maybe I can help,
I was the one who originally told him to use "nil", but the gentleman did
not like that -- I think I may have figured out what he's saying...but not
entirely certain.
If I'm correct, he's talking about having a tableview that has any number of
rows (vary-able at runtime) and each row has an NSPopUpButtonCell. He wants
to dynamically generate the choices on each menu, most likely (again,
guessing here) based on the other contents of the row that the NSPUBC is in.
I think.
So basically he has a couple of ways to go about it. He can send nil as the
object arg to the notification registration. In which case he'll have some
handler for the notification that will look like this:
somehowFindParentRowOf( [notification object] )
generateMenuBasedOnContentsOfRow( )
I think he's got some feeling that it will be ugly and he'll have to have
some big switch statement or other "extra messaging overhead" to figure out
what's going on in order to be able to generate the menu, and he would like
to lower his overhead. His "lowering the overhead" proposal is to subclass
NSPopUpButtonCell, so that he can register each one of those NSPUBC's as
"self" with the notification center and have each instance handle its own
work. I am not convinced that this is the superior approach, since you
still have the problem of the NSPUBC knowing what to generate for itself.
Perhaps one of the more experienced folks can help him with the
architectural concepts at play here, since my suggestion to use nil and
catch all of the notifications was not well received by the poster, if I
understood his response properly (the "bad programming"). I'm basically
going on the strategies laid out in Hillegass and in the Notifications trail
in the documentation, so my level of experience may not be what is required
to be helpful to this gentleman.
Then again, I am just reading between the lines as none of the original
poster's emails have been too clear as to exactly what he's doing.
cheers
fillup
On 6/14/02 12:42 AM, "mmalcolm crawford" <email@hidden> wrote:
>
On Thursday, June 13, 2002, at 11:51 PM, Cristian Savu wrote:
>
>
> What I don't know is how to get the name of the object cell,
>
> because the
>
> cell is situated in a table and I do not have an instance of the cells.
>
>
>
It's possible I'm missing something in these exchanges, but in general
>
you certainly do have access to the cells in a tableview -- as has been
>
mentioned several times in the last month or two...
>
For any table column in a tableview, you can get, or set, its dataCell...
>
>
mmalc
>
_______________________________________________
>
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.