Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct way to handle kEventCommandUpdateStatus?



On Friday, Aug 29, 2003, at 15:06 US/Eastern, Eric Schlegel wrote:
On Aug 29, 2003, at 11:17 AM, Jim Correia wrote:
If my window can handle 100 commands, then the application also has to know about those specific 100 command ids so it can disable them if the event percolates up to the application.
Am I missing something in how this event should be handled conceptually? Is there a better way to deal with this situation?

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.

Couldn't the application handler handle the commands it knows about (using a switch statement, etc.), and then have a default way of dealing with others? For unknown commands, the application could call the next handler and if it returns eventNotHandledErr, then nobody is dealing with the command, so the menu item can be disabled with DisableMenuCommand(). No?


----------------------------------------------------------------------
Philip D. Wasson pwasson at maned dot com
Software Engineer Managing Editor Inc.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Correct way to handle kEventCommandUpdateStatus? (From: Eric Schlegel <email@hidden>)



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.