Why is NSMenu indexOfIitemWithTag unpredictable?
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