Request for -[NSApplication beginSheet:modalForWindow:completionHandler:] method

Originator:bewebste
Number:rdar://7300105 Date Originated:10/13/2009
Status:Duplicate/6209681 Resolved:
Product:Mac OS X Product Version:10.6.1
Classification:Enhancement Reproducible:Not applicable
 
Since the new addition of blocks to Objective-C in Snow Leopard, many Foundation/AppKit classes have added new methods that use a "completion handler" block as a callback, rather than the old method of passing a delegate, a callback selector, and a contextInfo parameter.  

For example, in 10.6, NSSavePanel now has a method: 

- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler

which replaces the old method

- (void)beginSheetForDirectory:(NSString *)path file:(NSString *)name modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo method.

However, no such method exists to replace the NSApplication method:

- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo  

I would like to see a method along the lines of:

- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow completionHandler:(void (^)(NSInteger result))handler

that would allow using custom sheets without having to resort to the clunky setup of implementing a callback selector and passing around a contextInfo parameter.





Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!