2

I've noticed an interesting behavior and I wonder if it's something I'm doing wrong. I have an NSPopUpButton with several NSMenuItems on an NSMenu on the NSPopUpButton. When I click the popup button and select an item the action that I've linked to the NSPopUpButton gets triggered UNLESS the menu item I select defines it's own action:@selector(method). In that case, the method in the selector gets fired and the other action does not. I would think both should happen.

Also related to this, if I have selectors on menu items, and I call [popUpButton selectItemAtIndex:index] shouldn't that call the selector on the appropriate menu item?

Is this the correct behavior?

JPC
  • 8,096
  • 22
  • 77
  • 110
  • I'm concluding it is in fact the correct behavior – JPC Aug 25 '11 at 16:05
  • 1
    I would assume this is the correct behaviour also. Apple probably sets an action for all the menu items in the popover which calls a method in the `NSPopUpButton` class which then calls the action you have linked to the popup button. By setting the action for the menu item directly it prevents this from taking place. – Joshua Aug 26 '11 at 16:07

0 Answers0