Hello all,
we have problem with a minimalistic application that opens standard alert sheet. The code looks like this:

int main(int ac, char *av[])
{
NSApplication *app=[NSApplication sharedApplication]; // tried to send activateIgnoringOtherApps:YES, in vain
        NSRect frame=NSMakeRect(100,100,600,400);
NSWindow *win=[[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained defer:NO]; [win setAlphaValue:0]; // we don't want to show the window--it's just the sheet "base"
        [win setLevel:NSNormalWindowLevel+1];
        [win orderFrontRegardless];
NSBeginAlertSheet(@"...", nil, nil, nil, win, nil, NULL, NULL, NULL, @"...");
        [app runModalForWindow:[win attachedSheet]];
        return 0;
}

The application correctly opens alert sheet but does not get any keyboard actions nor events — they are still sent to previous open app. Nevertheless, sheet could be closed by mouse. We also try to use NSRunAlertPanel with the same output, so we suspect the problem is on the Window Server side (or between WS and our app).

This did not help either:

@implementation Delegate:NSObject
+(void)applicationDidFinishLaunching:(NSNotification*)dummy
{
        NSRect frame=NSMakeRect(100,100,600,400);
NSWindow *win=[[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained defer:NO]; [win setAlphaValue:0]; // we don't want to show the window--it's just the sheet "base"
        [win setLevel:NSNormalWindowLevel+1];
        [win orderFrontRegardless];
        [NSApp activateIgnoringOtherApps:YES];
NSBeginAlertSheet(@"...", nil, nil, nil, win, self, NULL, @selector(done), NULL, @"...");
}
+(void)done
{
        [NSApp terminate:self];
}
@end

int main(int ac,char *av[])
{
        NSApplication *app=[NSApplication sharedApplication];
        [app setDelegate:[Delegate class]];
        [app run];
        return 0;
}

Does anyone know, where could be problem or what do we wrong?
Thanks!

Tom

--
Tomáš Kolář
to...@audiffex.com
Audiffex - Audio Effects & Applications
www.audiffex.com

_______________________________________________

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