• 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
SEL and NSSelectorFromString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SEL and NSSelectorFromString


  • Subject: SEL and NSSelectorFromString
  • From: Jason Blake <email@hidden>
  • Date: Sat, 19 Jan 2002 20:12:57 -0600

I can't find much documentation for what SEL is, or what the format the parameter for NSSelectorFromString takes. In particular I have successfully added menu items to my applications dock menu. however when building up the menuitems for my menu and using the following:

#import "AppMenuController.h"

@implementation AppMenuController
- (void)awakeFromNib
{
//create menu
SEL action = NSSelectorFromString(@"item1");
appMenu=[[NSMenu alloc] initWithTitle:@"title"];
[appMenu addItem:[ [NSMenuItem alloc] initWithTitle:@"item 1" action:action keyEquivalent:@""] ];
}
-(void) item1
{
NSLog(@"%@",@"\nItem1 selected");
}
//NSApplication delegate methods

- (NSMenu *)applicationDockMenu:(NSApplication *)sender
{
return appMenu;
}
@end

When running the app "item 1" shows up and is selectable, but when I select it I get no log message. Can anyone help


  • Follow-Ups:
    • Re: SEL and NSSelectorFromString
      • From: Ondra Cada <email@hidden>
    • Re: SEL and NSSelectorFromString
      • From: Nick Müller <email@hidden>
  • Prev by Date: Re: Window to Window handling
  • Next by Date: Re: How to choose file without extension in NSOpenPanel
  • Previous by thread: Re: Window to Window handling
  • Next by thread: Re: SEL and NSSelectorFromString
  • Index(es):
    • Date
    • Thread