• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
can't read NSMenuItem titles from NSMenu's below first NSMenu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: can't read NSMenuItem titles from NSMenu's below first NSMenu
      • From: Graham Cox <email@hidden>
  • Prev by Date: All Address Book person unique IDs are the same [solved]
  • Next by Date: Re: can't read NSMenuItem titles from NSMenu's below first NSMenu
  • Previous by thread: All Address Book person unique IDs are the same [solved]
  • Next by thread: Re: can't read NSMenuItem titles from NSMenu's below first NSMenu
  • Index(es):
    • Date
    • Thread