Re: NSMenuItem / NSMenu Problems
Re: NSMenuItem / NSMenu Problems
- Subject: Re: NSMenuItem / NSMenu Problems
- From: John Stiles <email@hidden>
- Date: Wed, 09 Jan 2008 16:27:58 -0800
For the first, use +[NSMenuItem separatorItem].
For the second, make a method inside your class. e.g.:
-(void) doMyThing:(id)sender {
// whatever
}
And then use action:@selector(doMyThing:) to hook it up. You'll also
need to use setTarget: and point it at your class.
Jeremy wrote:
I have been programming in Cocoa for not a long time. It really isn't
doing the best... for me right now. Here is my NSMenu problems:
Within my application, Tune-A-Holic, up until now I have been using it
only to retrieve the information from iTunes and display it. The only
function I have used is updateData: which was called within an
NSDistributedNotifications call. My menu problems lie within expanding
the application to have the ability to control iTunes from the menu.
My first problem lies within separation. I would like to separate any
control items and non-information items from the information that is
displayed at the beginning of the drop down. The look I want can be
found within the Apple menu between Mac OS X Software and System
Preferences. I have found no reference to a function to do this within
NSMenu.
My second problem lies within the fact that I want to control iTunes.
It is another adventure within Scripting Bridge that I want to mess
with. Here is the problem I am having:
sOne = [subMenu addItemWithTitle:@"Item" action:nil keyEquivalent:@""];
I can't figure out how to use the action: part of this line. The
NSMenu class reference mentions that this must be a selector, so I
used @selector() but that doesn't seem to work.
Any help on either issue would be greatly 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
_______________________________________________
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