NSWindow makeKeyAndOrderFront使窗口出现,但不是Key或Front [英] NSWindow makeKeyAndOrderFront makes window appear, but not Key or Front

查看:2037
本文介绍了NSWindow makeKeyAndOrderFront使窗口出现,但不是Key或Front的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

makeKeyAndOrderFront 不会使我的NSWindow键或前面。

makeKeyAndOrderFront is not making my NSWindow key or front.

我的应用程式主窗口或菜单,这可能是问题的一部分?

My app does not have a main window or menubar, which may be part of the problem?

IBOutlet NSWindow *loginWindow;
//(connected in Interface Builder to the NSWindow)

NSWindow

然后:

- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
{
    [loginWindow makeKeyAndOrderFront:self];
}

打开窗口。

但是:


  • >

    它出现在Xcode窗口后面(不是前面)。

  • It appears behind the Xcode window (not front).

它似乎接收鼠标焦点,但不会在窗口包含的文本字段中进行按键操作。

It appears to recieve mouse focus, but will not take keypresses in the textfields the window contains. The keypresses are sent to Xcode.

当Expose激活时,它会出现在公开网格中。但我无法点击窗口在Expose ...中选择它。它不会来到前面。

It appears in the Expose grid when Expose is activated. But I cannot click the window to select it in Expose... it won't come to the front.

为什么我的窗口不工作?

Why isn't my Window working?

推荐答案

在黑暗中刺入:你有 LSBackgroundOnly 在您的Info.plist中设置。这就是为什么它不工作:一个后台应用程序不能来到前台,这就是为什么你的窗口不会来到前台。

Stab in the dark: You have LSBackgroundOnly set in your Info.plist. That's what makes this not work: A background-only application cannot come to the foreground, which is why your window does not come to the foreground.

如果你想要你的应用程序要不显示在Dock中,请改为设置 LSUIElement 。这会禁止您的应用程序的Dock平铺,并阻止它在菜单栏中显示自己的主菜单,但保留了将窗口置于最前面并将其设为关键的能力。

If you want your app to not show up in the Dock, set LSUIElement instead. This suppresses your app's Dock tile and keeps it from showing its own main menu in the menu bar, but preserves its ability to bring a window frontmost and make it key.

这篇关于NSWindow makeKeyAndOrderFront使窗口出现,但不是Key或Front的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆