简体   繁体   English

NSApplication重新签署最前面的应用程序状态:隐藏v。停用

[英]NSApplication resigning front most application status: hide v. deactivate

I've got an application that needs to become the front most application after a timer expires and resign the front most status when the timer is started by pressing a button, eg 我有一个应用程序需要在计时器到期后成为最前面的应用程序,并在按下按钮启动计时器时重新调整最前面的状态,例如

  • click "start timer" -> app resigns front most application 单击“启动计时器” - >应用程序将重置最前面的应用程序
  • timer expires -> app becomes front most application 计时器到期 - >应用程序成为最前面的应用程序

I deliberately paraphrased things a little because playing with active status of the sharedApplication doesn't do what I want. 我故意解释一些事情,因为使用sharedApplication活动状态不能做我想要的。

I become the front most app by doing a [[NSApplication sharedApplication] activateIgnoringOtherApps: YES] and that works perfectly well. 通过[[NSApplication sharedApplication] activateIgnoringOtherApps: YES]成为最前面的应用程序,这非常有效。

Doing the reverse seems impossible!? 做反向似乎不可能!?

  • [[NSApplication sharedApplication] deactivate] shouldn't be called directly, but more importantly doesn't bring the next application in the "command-tab order" forwards. 不应直接调用[[NSApplication sharedApplication] deactivate] ,但更重要的是不要将下一个应用程序置于“命令选项卡顺序”转发中。 The app just sits there with its menu bar showing but it's no longer " active ". 该应用程序只是坐在那里,其菜单栏显示,但它不再“ 活跃 ”。

  • [[NSApplication sharedApplication] hide: self] resigns the active status and brings the next application in the " Command-tab order " to the front BUT it also hides all the application windows. [[NSApplication sharedApplication] hide: self]启动活动状态并将下一个应用程序以“ 命令选项卡顺序 ”引入前端但是它还隐藏了所有应用程序窗口。

I need some way of bringing the next application in the command-tab order to the front WITHOUT hiding all my windows. 我需要一些方法将命令选项卡顺序中的下一个应用程序放到前面而不隐藏我的所有窗口。

Is there a good way of doing that? 这样做有好办法吗?

The solution should be 10.5 Leopard and 10.6 compatible. 解决方案应该是10.5 Leopard和10.6兼容。

I do have a solution from around 1996 but it involves Carbon APIs and I'd really prefer doing it the Cocoa or at least Foundation way.. 我确实有一个解决方案,从1996年左右开始,但它涉及到Carbon API,我真的更喜欢Cocoa,或者至少是基金会方式。

Any help would be greatly appreciated. 任何帮助将不胜感激。

您是否尝试过隐藏,然后取消隐藏无活动?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM