Re: Object from TableView cell
Re: Object from TableView cell
- Subject: Re: Object from TableView cell
- From: Cristian Savu <email@hidden>
- Date: Fri, 14 Jun 2002 08:51:01 +0200
On 6/14/02 5:41 AM, "Gregory Weston" <email@hidden> wrote:
>
I must be missing something...
Yes you are.
Look this is the original message:
"
Look, I have a tableView filled with popUpButtons and I need to
populate
the corresponding menus after the user clicks the button. For this I'm
using
NSPopUpButtonCellWillPopUpNotification.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(DoCreateMenu:)
name:NSPopUpButtonCellWillPopUpNotification object:<<I DON'T
KNOW>>];
The problem I run into is that I have no Ideea what to put as object
parameter when I want to register the observer. If I leave nil, all the
popUpButtons are populated throught the same selector and I don't need
that. "
The ideea is that I have popUpButtons in the table (the menus of these
buttons should be populated throught DoCreateMenu:), but I also have
popUpButtons elswere and these buttons have no need for DoCreateMenu:.
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.
>
> I already thought at this but a subclassing of NSPopUpButton is necessary
>
>
Why? I don't get why you have to subclass NSPopUpButton to handle the
>
notifications it sends.
In order to select between different senders of the notification, I've
subclassed NSPopUpButtonCell and in DoCreateMenu: I've added:
if ([[notification object] class] isEqual:@"subclassName"])
//pupulate table popUpButtons menus
>
> and I was trying to avoid this. Also, using nil as object: argument is an
>
> example of bad programming.
>
Why? I'm under the impression that passing nil as the object argument is the
>
defined mechanism for indicating that you want these notifications regardless
>
of
>
the originating instance. I'm at a loss to understand how using something in
>
the
>
way it's documented is "bad programming."
I never said anything about documentation. I should say "not good
programming style" instead of "bad programming".
If you put nill, there is an extra call for all
NSPopUpButtonCellWillPopUpNotification selector methods and if you have a
big, I mean really big application, the speed will be affected.
Anyway, I'm still waiting for a beter solution (if this exists).
Regards, Cristian
_______________________________________________
>
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.