Disable items in an NSPopUpButton
I have a NSPopUpButton in a non-document based app where you can select 15 items(video mpaa ratings). I would like to have a couple of "headings" that are disabled. I believe what I need is:
- (BOOL)validateUserInterfaceItem:(NSMenuItem *)item
{
NSLog(@"Validating Menus");
//int tag = [item tag];
if ([item tag]==1 || [item tag]==2)
{
return NO;
}
return YES;
}
but it is never getting called. I think I am missing a basic piece of info to make this work. I have read a bunch of info and cannot figure out how to get this called in myAppcontroller class. Any help would be appreciated.
Thanks,
Todd
UPDATE:It was a simple mistake. My pop up button had no action set. I was just grabbing the title from it. I created an empty action and connected it and the - (BOOL)validateUserInterfaceItem: is now getting called.
Aye, laddie (scottish accent optional), you've got to watch your IBActions around this cocoa stuff.
I've fallen down that man-holes (and many others). Cocoa is really good stuff - however learning and taming the beast is a challenge.
The answers are always simple. Finding them is seldom. When my boss says "how long will it take you fix bug xxxx", I always say "5 minutes". Of course that's the answer to how long to fix it, not how long it will take to know what to fix!!!! (we usually have not idea how long that will take).