Re: Creating Menu Items Programmatically.
Re: Creating Menu Items Programmatically.
- Subject: Re: Creating Menu Items Programmatically.
- From: Peter Robinson <email@hidden>
- Date: Thu, 13 Feb 2003 12:08:16 +0000
At 11:23 am +0000 13/2/03, Steve wrote:
1) What's the most convenient way to just turn the (long)portNum in
to a string that initWithTitle will accept?
long portNum;
NSMenuItem *menItem;
for( portNum=1; portNum <=numInputs; portNum ++)
{
menItem = [NSMenuItem alloc];
[menItem initWithTitle: [NSString stringWithFormat: @"%i", portNum]
action: @selector(setInputPort:) keyEquivalent: @""];
[menuInPort addItem:menItem];
}
2) The selector (which is part of the same controller class) is not
being called. I have an idea that the newly created items might
mistakenly think the First Responder is the target.
They do. That will work as long as your controller class is
somewhere in the responder chain, and as long as nothing earlier
responds to that selector. [The selector @selector(setInputPort:)
has a colon.]
Peter
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.