Skip navigation.
 
mlRe: Alert Sheets hard wired in Interface Builder
FROM : Graham Cox
DATE : Thu May 29 05:58:48 2008

Here's a trivial category to address this. Whether it's really worth 
using is hard to say, but for what it's worth:


@interface NSWindow (SheetAdditions)

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

@end


@implementation NSWindow (SheetAdditions)


- (void)    beginSheet:(NSWindow*) sheet modalDelegate:(id) modalDelegate 
didEndSelector:(SEL) didEndSelector contextInfo:(void*) contextInfo
{
   [NSApp beginSheet:sheet modalForWindow:self 
modalDelegate:modalDelegate didEndSelector:didEndSelector 
contextInfo:contextInfo];
}


- (void)    beginSheetModalForWindow:(NSWindow*) docWindow modalDelegate:
(id) modalDelegate didEndSelector:(SEL) didEndSelector contextInfo:
(void*) contextInfo;
{
   [NSApp beginSheet:self modalForWindow:docWindow 
modalDelegate:modalDelegate didEndSelector:didEndSelector 
contextInfo:contextInfo];
}


@end



On 29 May 2008, at 1:29 pm, Scott Ribe wrote:

>> I agree with your assessment. What business has NSApplication
>> providing this method? it doesn't make sense.

>
> Probably because it involves the run loop and event dispatch, since 
> the
> running a window as a sheet must ensure that the window to which the 
> sheet
> is attached does not receive events, yet a click in that parent 
> window must
> bring the pair forward... Further, I'll bet it's also there because 
> the
> method to run a window application-modally was there first. So if 
> you think
> about what the method must *really* do, it no longer appears to be 
> so bound
> to the window, because it requires doing things that are clearly not 
> the
> responsibility of the window. Yes, the method could be in NSWindow 
> and call
> on NSApplication to get that done, but, should a window really be 
> able to
> have such a drastic effect on the events going to other windows???
>
> But I had the same difficulty as everybody else locating it the 
> first time.
> And then again, later, when I had not used it for a while ;-)
>
> --
> Scott Ribe
> <email_removed>
> http://www.killerbytes.com/
> (303) 722-0567 voice
>
>

Related mailsAuthorDate
mlAlert Sheets hard wired in Interface Builder John Love May 27, 22:28
mlRe: Alert Sheets hard wired in Interface Builder Sherman Pendley May 27, 22:38
mlRe: Alert Sheets hard wired in Interface Builder Kyle Sluder May 27, 22:40
mlRe: Alert Sheets hard wired in Interface Builder Jens Alfke May 28, 06:06
mlRe: Alert Sheets hard wired in Interface Builder Graham Cox May 28, 06:24
mlRe: Alert Sheets hard wired in Interface Builder Scott Ribe May 29, 05:29
mlRe: Alert Sheets hard wired in Interface Builder Kyle Sluder May 29, 05:38
mlRe: Alert Sheets hard wired in Interface Builder Jens Alfke May 29, 05:39
mlRe: Alert Sheets hard wired in Interface Builder Graham Cox May 29, 05:58
mlRe: Alert Sheets hard wired in Interface Builder Chris Hanson May 29, 07:44
mlRe: Alert Sheets hard wired in Interface Builder John Love May 31, 17:43
mlRe: Alert Sheets hard wired in Interface Builder John Love May 31, 18:40
mlRe: Alert Sheets hard wired in Interface Builder Keary Suska May 31, 19:08
mlRe: Alert Sheets hard wired in Interface Builder Jens Alfke May 31, 19:22
mlRe: Alert Sheets hard wired in Interface Builder John Love Jun 1, 20:19
mlRe: Alert Sheets hard wired in Interface Builder Jens Alfke Jun 1, 21:07
mlRe: Alert Sheets hard wired in Interface Builder Nathan Kinsinger Jun 1, 21:15
mlRe: Alert Sheets hard wired in Interface Builder John Love Jun 3, 22:27