Re: hey, who's enabling my window's close button?
Re: hey, who's enabling my window's close button?
- Subject: Re: hey, who's enabling my window's close button?
- From: b UND d <email@hidden>
- Date: Fri, 13 Apr 2007 10:49:20 +0200
On 12.04.2007, at 20:26, Matt Neuburg wrote:
Because of certain quirks of Interface Builder's assumptions about
windows,
my window's awakeFromNib: calls
[[window standardWindowButton:NSWindowCloseButton] setEnabled:NO];
However, I've just started putting NSAlert sheets up in front of my
window,
and now I discover that when a sheet closes, the close button is
enabled
again! I can counteract this by calling setEnabled:NO again, every
time, but
shouldn't this behavior count as a bug? m.
PS Okay, you might ask, what quirks? Well, I want a utility window
with a
Minimize button but no Close button. But if you specify no Close
button for
utiity window in Interface Builder, you get no buttons at all
(including no
Minimize button)! I regard this as a bug too (or at least kind of
wacky).
Matt,
Utility windows cannot be minimized (at least they should not ... see
the AquaHIGuidelines) - that's probably why an NSPanel with 'Utility
Window' checked and only 'Minimize Button' selected shows no title
bar controls at all.
I made a test with a Utility Panel with checked Minimize and Zoom
buttons (Close unchecked) and added the following code in
awakeFromNib. It seems to work as expected (before and after an alert
sheet) :
[[utWindow standardWindowButton:NSWindowMiniaturizeButton ]
setEnabled:YES];
[utWindow update];
I didn't succeed in enabling only the Miniaturize button and keeping
the state of the two other buttons after the alert sheet is ended.
There is a similar effect after the sheet is displayed: the second
checked button (which i had to check to made the controls visible at
all) becomes enabled ... I guess you will to use your little trick
for this or maybe you can fix it in a subclass of NSPanel.
Hope that helps ...
Dominik
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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