Re: Dealing with NSPopupButton
Re: Dealing with NSPopupButton
- Subject: Re: Dealing with NSPopupButton
- From: Pete Yandell <email@hidden>
- Date: Sat, 23 Feb 2002 23:03:20 +1100
You only need to set a target for the popup menu, not for each
individual item.
Try something like this to build the menu, probably in your awakeFromNib
method:
[myPopUp addItemWithTitle:@"Letter"];
[myPopUp addItemWithTitle:@"Legal"];
[myPopUp addItemWithTitle:@"A4"];
And then, the target for your popup should look like:
- (IBAction)menuChanged:(id)sender
{
if ([[myPopUp titleOfSelectedItem] isEqualToString:@"Letter"]) {
...
}
else if (...) {
}
}
You get the idea. You can also use indexOfSelectedItem method to get
the index.
On Saturday, February 23, 2002, at 03:50 PM, Ben Mackin wrote:
Ok, I am new and have asked a few questions on this list, and have
gotten
some great responses.
New question now. I have created an Popup menu in interface builder.
Do I
need to setup the popup menu it self as a target, or each individual
menu In
the popup menu as a target? Did that make sense?
I have a menu with 3 choices: Letter, Legal, A4
I want to be able to find out what the user choose, and act accordingly.
Thanks,
Ben
http://www.shayufilms.com
_______________________________________________
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.
Pete Yandell
http://pete.yandell.com/
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
_______________________________________________
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.