Re: Menu items vs modal sessions
Re: Menu items vs modal sessions
- Subject: Re: Menu items vs modal sessions
- From: Keary Suska <email@hidden>
- Date: Sun, 13 Apr 2008 13:25:41 -0600
- Thread-topic: Menu items vs modal sessions
on 4/13/08 10:12 AM, email@hidden purportedly said:
> How come some menu items are enabled and others disabled while there
> is a modal session going on?
Because the UI has to protect the integrity of the concept of modality. If
you bring up an application-modal window, you wouldn't want a user to be
able to ignore it, would you?
> Does this mean that Apple has implemented validateMenuItem somewhere
> in the responder chain to check for modalWindow and attachedSheet?
> Where in the responder chain would that be?
I am not sure precisely how AppKit does this, but I imagine that it simply
restricts event messages to just what the window can respond to (and maybe
more--don't recall now), depending on modality.
> I have wired up most of my menu items using Cocoa bindings. It would
> then only seem logical to use bindings to determine if those menu
> items should be enabled when a modal window or sheet is being
> displayed. So I bound enabled to NSApp.modalWindow and to
> window.attachedSheet using a NSIsNil transformer. Is the way to go?
If you already get certain behavior for free, why complexify it needlessly?
What problem are you trying to solve? If you have menu items that are
enabled during certain modal sessions, and you specifically don't want them
to, then you should look at your application design and adjust accordingly.
So, I guess to answer your questions, I would say, "probably not."
Better to follow the ways that AppKit wants you to do things (such as
intelligent use of the responder chain), rather than jerry-rig a band-aid
solution.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden