can't read NSMenuItem titles from NSMenu's below first NSMenu
can't read NSMenuItem titles from NSMenu's below first NSMenu
- Subject: can't read NSMenuItem titles from NSMenu's below first NSMenu
- From: SRD <email@hidden>
- Date: Thu, 12 Nov 2009 21:09:49 -0600
I have an NSPopUpButton of type pulldown with the following structure:
NSMenu
|- NSMenu ---> item-1 // can't read value from sender
|- item-2 // can read sender
|- item-3 // can read sender
When selecting anything off the first menu (item-2 or item-3), the
value of 'sender' prints fine and I can compare it using the code
below. But if I select the first item which is an NSMenu and leads to
another NSMenu with it's item (item-1), then the method menuReader: is
called, but sender does not hold any value at all, it's just blank.
Anyone understand what I'm doing wrong here?
- (IBAction) menuReader:(id) sender
{
NSLog(@"sender %@", [sender titleOfSelectedItem]);
if ([[sender titleOfSelectedItem] isEqualToString:@"item1"]) {
// ...
}
else if ([[sender titleOfSelectedItem] isEqualToString:@"item2"]) {
// ...
}
else if ([[sender titleOfSelectedItem] isEqualToString:@"item3"]) {
// ...
}
}
Any help much appreciated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden