From 28c7b8a60d9150cba1909b754dfd67ab34950c2c Mon Sep 17 00:00:00 2001 From: Christopher Lloyd Date: Fri, 23 Mar 2012 02:00:46 -0400 Subject: [PATCH] add accessoryView as subview so that it can be made first responder with a field editor immediately --- AppKit/NSAlert.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AppKit/NSAlert.m b/AppKit/NSAlert.m index 270cebe5..1d16ea85 100644 --- a/AppKit/NSAlert.m +++ b/AppKit/NSAlert.m @@ -181,8 +181,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -(void)setAccessoryView:(NSView *)value { value=[value retain]; + + [_accessoryView removeFromSuperview]; [_accessoryView release]; _accessoryView=value; + + // We must add it as a subview here such that a makeFirstResponder: immediately after + // works properly by setting up the field editor + [[_window contentView] addSubview:_accessoryView]; + _needsLayout=YES; } @@ -382,7 +389,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI frame.origin.x=LEFT_MARGIN+iconSize.width+ICON_MAIN_GAP; frame.origin.y=panelSize.height-TOP_MARGIN-messageSize.height-messageInformativeGap-informativeSize.height-informativeSuppressionGap-supressionSize.height-suppressionAccessoryGap-frame.size.height; [_accessoryView setFrame:frame]; - [[_window contentView] addSubview:_accessoryView]; } NSPoint origin={panelSize.width-RIGHT_MARGIN,BOTTOM_MARGIN};