Re: NSPanel should not close on command-W
Re: NSPanel should not close on command-W
- Subject: Re: NSPanel should not close on command-W
- From: Georg Seifert <email@hidden>
- Date: Sat, 21 Jun 2008 19:10:32 +0200
I just added a panel to my program. I do not want that the panel
closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It does
not close if there is a document window. But if the last one is
closed
(with keyboard: command-W) also the panel closes.
How do I prevent this?
I am not sure I understand the exact issue, so I will suggest a few
options.
1. You can disable the close button on the panel, which should
prevent it
being closed by the menu, but also prevents it from being closed at
all.
Useful if you have (or are willing to implement) a show/hide toggle
menu for
the panel.
2. If you just don't want the panel to respond to the close menu,
simply
implement -validateUserInterfaceItem: in an appropriate place in the
responder chain. The side effect here is that the close menu item
will be
disabled any time the panel is key, which is probably OK as you have
it set
up at the moment.
3. If you meant to say that when you close the last document window
that the
panel closes at the same time, then I am not sure what that would
mean other
than something is rather wrong.
Just a general note: if the (red) close button on the panel is
enabled,
users may expect that command-W will close it when it is made key.
There may
also be a HIG issue with this.
HTH,
Thanks for you suggestions.
I use the panel as a palette. Something like the systems font chooser.
They have the close button enabled, but do not responde to close
commands from the keyboard.
I could implement "windowShouldClose:" in the delegate but I do not
know the source of the close event.
G
_______________________________________________
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