Re: Popup button crash
Re: Popup button crash
- Subject: Re: Popup button crash
- From: Carlos Weber <email@hidden>
- Date: Tue, 26 Feb 2002 07:26:18 -1000
On Monday, February 25, 2002, at 06:24 , Rosyna wrote:
I'm trying to build a popup button's menu based on context as soon as
the menu is requested. I do this by adding an observer for my Popup
button's cell in awakeFromNib like so:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(popup:) name:NSPopUpButtonCellWillPopUpNotification
object:[view cell]];
then the selector:
- (void)popup:(NSNotification *)notification
{
NSMenu* theMun=[[NSApp mainMenu] copyWithZone:
NSDefaultMallocZone()];
NSLog(NSStringFromClass([[notification object] class]));
//NSPopUpButtonCell
[[notification object] setMenu:theMun];
}
as soon as popup finishes, the application crashes with a SIGABRT error.
Is it even possible to do what I am trying to do?
Rosyna, I haven't worked with NSPopUpButtons, but I have wrangled with
the problem of building a menu "just-in-time". I dealt with it by
subclassing NSMenuItem in order to override the -submenu method
(strangely enough).
If you think this bit would be of help in solving your problem, you can
download a ProjectBuilder project elucidating all this from
http://homepage.mac.com/carlosweber
(Be sure to read the brief ReadMe file before trying to build the
project. You will need to modify the build specifications slightly for
the project to work on your local disk.)
_______________________________________________
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.