Re: NSMenu and NSMenuItem help
Re: NSMenu and NSMenuItem help
- Subject: Re: NSMenu and NSMenuItem help
- From: Jeff LaMarche <email@hidden>
- Date: Thu, 10 Jan 2002 08:45:28 -0800
On Thursday, January 10, 2002, at 12:22 AM, Mike Shields wrote:
Read the error. You did not get an NSMenu back from the first
-itemAtIndex:, you got an NSMenuItem. Having never used the menu APIs,
I suspect you'll need to somehow get the submenu of that menu item
first before doing anything else.
Believe me, I have read the error, and the doc (which is incomplete and
contains remnants of the NeXT menu functinoality) and the headers.
itemAtIndex: can return either an NSMenu or an NSMenuItem. In my case, I
am retrieving the Apple Menu, which is index 0, and NSLog confirms that
itemAtIndex has returned an NSMenu with the name "Apple Menu", and I get
no compiler warning, even without the cast, which was added while trying
to figure out the problem, and was not part of the original code. So,
itemAtIndex returns to me an NSMenu but when I sent it an itemAtIndex
message, which is valid for NSMenu, it gives me a warning as if I had
received an NSMenuItem instead of the submenu NSMenu...