检测在Mac AIR应用程序不同的退出选择 [英] Detecting different quit options in AIR application on Mac

查看:156
本文介绍了检测在Mac AIR应用程序不同的退出选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经运行在Mac上的AIR应用程序,我想有隐藏的窗口,当有人关闭的行为的应用程序(如点击红色的X按钮或CMD-W)。但是,如果有人打CMD-Q,或选择退出从码头上下文菜单或顶级菜单,我想应用程序,以实际关闭。

I have an AIR application running on a Mac and I want to have the behavior of hiding the window when someone "closes" the app (e.g. hits the red "x" button or cmd-w). However, if someone hits cmd-q or chooses "Quit" from the dock context menu or top level menu, I want the app to actually close.

我可以在$由应用程序发送的关闭事件p $ pventDefault,不过,这将导致所有的亲密的方法,只是隐藏窗口。有人只有这样,才能关闭应用程序在这一点上是ForceQuit(或通过一个单独的接口本人提供,喜欢上了停靠栏图标的上下文菜单选项)。

I can preventDefault on the "closing" event sent by the application, however, this causes all "close" methods to just hide the window. The only way for someone to close the application at that point is ForceQuit (or through a separate interface I provide, like a context menu option on the dock icon).

我也尝试过手动捕捉CMD-Q keyDown事件,但它不会发送。此外,这将不适合的情况下帮助当人们试图使用菜单选项来退出程序。

I have also tried capturing the cmd-q keyDown event manually, but it doesn't get sent. Also, this wouldn't help for the case when people try to quit the app using the menu options.

此外,如果I $日的收盘方法P $ pventDefault,它使我的应用程序,立即取消关机过程(这是一个可怕的用户体验)。

Furthermore, if I preventDefault on the closing method, it causes my application to cancel a shut down process immediately (which is a terrible user experience).

有没有一种方法来检测关闭AIR应用程序的不同的方法?我希望能够告诉这些关闭方法之间的差异,并作出反应,适当的。

Is there a way to detect different methods of closing an AIR application? I want to be able to tell the difference between these closing methods and react to the appropriately.

推荐答案

试试本作的最后,从我的理解有/是在框架中的bug,因此如果包括AIR更新它打破CMD-Q支持,曾经是这里的主题:<一href="http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=670&threadid=1373568">http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=670&threadid=1373568

Try this for the closing, from what I understand there was / is a bug in the framework so that if you include the AIR updater it breaks cmd-q support, the thread used to be here: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=670&threadid=1373568

这可能会或可能不适用于您的情况。

This may or may not be applicable to your situation.

NativeApplication.nativeApplication.addEventListener(Event.EXITING, 
		function(e:Event):void {
			var opened:Array = NativeApplication.nativeApplication.openedWindows;
			for (var i:int = 0; i < opened.length; i ++) {
				opened[i].close();
			}
	});

这篇关于检测在Mac AIR应用程序不同的退出选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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