| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I hadn't really thought about this particular issue before, but yes, this seems to be a valid concern to me. Your app does need to know about all the command IDs that would need to be disabled if no window is open to implement that command ID. As the set of command IDs grows larger, a simple switch statement could potentially be quite inefficient, depending on what kind of code the compiler generates.
You might consider having a little command management architecture that would keep, say, a CFSet of all the app's command IDs, using the command ID as the key. Your app handler could look up the command ID in the set (which should be much faster than a linear search over all command IDs) and disable the menu item if the command ID is present in the set.
In Panther, we've also got a new menu item attribute, kMenuItemAttrAutoDisable, which indicates that a menu item should be automatically disabled if all kEventCommandUpdateStatus handlers return eventNotHandledErr. You could set that attribute on your menu items and then you wouldn't need an application handler just to disable items.
| References: | |
| >Re: Correct way to handle kEventCommandUpdateStatus? (From: Eric Schlegel <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.