On Mar 12, 2013, at 3:28 AM, anni saini wrote: > Thanks Ken. That works but this property doesn't make it active window.
Is your app already the active app at the time you show this window? If not and you want it to be then (as you noted), you should invoke -[NSApplication activateIgnoringOtherApps:]. You should also read the documentation for -[NSWindow canBecomeMainWindow] and -[NSWindow canBecomeKeyWindow]. If the default implementation of either of those methods is returning NO, then you should consider changing the nature of your window or overriding those methods to return YES. In particular, -canBecomeMainWindow defaults to NO for panels. Regards, Ken > > Regards, > Anni > From: Ken Thomases <k...@codeweavers.com> > To: anni saini <anni_sa...@yahoo.com> > Cc: "cocoa-dev@lists.apple.com" <cocoa-dev@lists.apple.com> > Sent: Monday, 11 March 2013 7:31 PM > Subject: Re: Issue with makeKeyAndOrderFront > > On Mar 11, 2013, at 3:15 AM, anni saini wrote: > > > My app is just having NSStatusBar menu such as Adium. On right click > > context menu, I'm calling some window to open. > > > > //Calling method > > myWindow = [[MyWindowViewController alloc]init]; > > myWindow.data = @"abc"; > > [myWindow show:self]; > > > > //Called method > > - (void)show:(NSWindow*)parentWindow > > { > > [myPanel centre]; > > > > [myPanel setFloatingPanel:YES]; > > > > [myPanel makeKeyAndOrderFront:nil]; > > > > } > > > > Observations: > > 1. When app doesn't have any window open. myPanel doesn't open until I open > > any window of my app. > > 2. When app have some window open but its in background, myPanel doesn't > > open until I click on any window of my app to make it front window. > > 3. When I tried to debug the issue, window gets open each time if I set > > break point in this method. > > 4. If I use [NSApp activateIgnoringOtherApps:YES]; before > > makeKeyAndOrderFront method, myPanel is working as expected. > > > > Please let me know whats wrong with the above code or how can i make it > > better? > > Your panel probably has hidesOnDeactivate set. > > Regards, > Ken > > > _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com