Re: Automatically activate next window after one is closed
Re: Automatically activate next window after one is closed
- Subject: Re: Automatically activate next window after one is closed
- From: Ken Thomases <email@hidden>
- Date: Sat, 15 Aug 2015 07:12:30 -0500
On Aug 15, 2015, at 1:32 AM, Felipe Monteiro de Carvalho <email@hidden> wrote:
> I have a nib-less Cocoa application which creates 2 forms, and 1 of
> them is visible. Upon clicking a button in this form, it shows another
> form.
>
> When I close this form, the other form is not activated automatically,
> causing the menu to not change.
>
> Any ideas about what exactly I am missing to get this automatically?
> I create the windows with
> NSWindow.alloc.initWithContentRect_styleMask_backing_defer
>
> (actually a NSWindow descendent)
That's PyObjC syntax, which not everybody on this list can be expected to recognize.
Anyway, is your app bundled in a .app bundle directory with a proper Info.plist, etc.? Or does it start as a command-line tool or naked executable? If the latter, do you transform it into a foreground process by setting the application object's activationPolicy to NSApplicationActivationPolicyRegular? Have you activated it using -activateIgnoringOtherApps: with a true argument?
Can your windows become key and main? Read the docs for -[NSWindow canBecomeMainWindow] and -canBecomeKeyWindow. The default implementations return NO in various cases and you have to override them to return YES if you want your windows to behave differently.
Did you actually make your windows key and/or main as appropriate when you presented them? Normally, you'd use -makeKeyAndOrderFront:, which does the right thing.
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