This is a newbie question I am certain. I am experimenting with sheets with
a simple application (1st cocoa app) and want to display a simple alert
message as a sheet.

1) So my first mistake was to use NSRunAlertPanel(). Did its thing but gave
me an independent window.

2) Further reading disclosed NSBeginAlertSheet(). Again an independent
window! Here is my code fragment:

...
        //NSRunAlertPanel( @"TITLE", @"MESSAGE", @"BUTTON1", @"BUTTON2",
@"BUTTON OTHER") ;
        NSBeginAlertSheet(@"TITLE", @"DFLT BUTTON", @"ALT BUTTON", @"OTHER
BUTTON",
                            [sourceTableView window],
                            self, // modal delegate
                            @selector(sheetDidEnd:returnCode:contextInfo:),
                            nil, // didDismissSelector
                            nil, // contextInfo
                            @"MESSAGE") ;
...

3) I then tried to create an NSPanel and use NSApp::beginSheet: do get the
job done. Again an independent window

...
        // create a new panel
        NSPanel* sheet = [[NSPanel new] init] ;
        // now run the panel/sheet
        [NSApp    beginSheet:sheet
                modalForWindow: [sourceTableView window]
                modalDelegate: nil
                didEndSelector: nil
                contextInfo: nil] ;
                
        [NSApp runModalForWindow:[sourceTableView window]] ;
        [NSApp endSheet:[sourceTableView window]];
        [[sourceTableView window] orderOut:self] ;
...

I guess I would have expected that #2 or #3 would have resulted in a sheet
on my main application window. What obvious detail did I miss?

TIA,

-harry


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to