• 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
Why is NSMenu indexOfIitemWithTag unpredictable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is NSMenu indexOfIitemWithTag unpredictable?


  • Subject: Why is NSMenu indexOfIitemWithTag unpredictable?
  • From: "Tony" <email@hidden>
  • Date: Fri, 5 Oct 2001 22:24:11 -0400

I have application where each menu item was assigned a different tag.
The intention is to execute menu item action programmatically
using NSMenu's performActionForItemAtIndex.

However, [ menu indexOfItemWithTag:NN] sometimes returns valid index
and sometimes -1, indicating menu item does not exist.

I could not find any hard rule in this behavior, but clicking app
menu with mouse usually results in indexOfItemWithTag returning a valid
index.
After executing menu action at some point I start getting -1 as index and
then,
of course, I can not execute menu item action. Eventually it starts
working and then failing again, and so on.

All topmost app menu items are mapped to IB outlets. On each outlet I call
submenu,
return of which is then used as the target for indexOfItemWithTag message.
I am running version 10.1.

Thanks for any suggestions,
Tony


  • Prev by Date: Re: retainCount
  • Next by Date: Re: retainCount
  • Previous by thread: isOpaque
  • Next by thread: Re: retainCount
  • Index(es):
    • Date
    • Thread