Re: NSAlert::runModal doesn't work on 10.6
Re: NSAlert::runModal doesn't work on 10.6
- Subject: Re: NSAlert::runModal doesn't work on 10.6
- From: Ken Thomases <email@hidden>
- Date: Mon, 22 Aug 2016 10:55:20 -0500
On Aug 22, 2016, at 10:46 AM, Andreas Falkenhahn <email@hidden> wrote:
>
> On 22.08.2016 at 17:30 Ken Thomases wrote:
>
>> On Aug 22, 2016, at 8:26 AM, Andreas Falkenhahn <email@hidden> wrote:
>
>>> I've created an NSAlert dialog …
>
>>> it shows up correctly but pressing a button doesn't do anything on 10.6. The
>>> dialog isn't closed and just stays there. …
>
>> Tell us more about the context. Is this a normal app or is it
>> unusual in some way?
>
> It is unusual in the way that it's not calling NSApplicationMain() but tries
> to imitate what NSApplicationMain() does. Here goes the code that is executed
> to set up the NSApp:
>
> pool = [[NSAutoreleasePool alloc] init];
>
> [MyApplication sharedApplication];
>
> [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
>
> appDelegate = [[MyApplicationDelegate alloc] init];
>
> [NSApp setDelegate:appDelegate];
> [NSApp run];
>
> In "applicationDidFinishLaunching" I then do this to assume control over
> the program again:
>
> [NSApp stop:nil];
>
> NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0];
>
> [NSApp postEvent:event atStart:YES];
>
> Posting the dummy event in didFinishLaunching is necessary to make sure that [NSApp run]
> returns. Otherwise it doesn't return before a real event comes in (e.g. by clicking
> its icon in the dock.)
>
>>
>> Is this in the same app from your other thread
>> where you're trying to shoehorn Cocoa into a C-based program? Can
>> you reproduce the problem in a new, standard Cocoa app project?
>
> Yup, see above ;)
This is ambiguous. Was the "yup" to my first or second question? If to the second, then what you wrote above is definitely not a standard Cocoa app. I'm trying to help you determine the specific factor that's causing the problem. The question is whether the games you're playing with the app loop are responsible. So, does the problem happen in an app where you don't play those games?
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden