返回按钮的问题
当我按下后退按钮时,会显示一个弹出屏幕,其中显示三个按钮“保存”、“丢弃”和“取消”按钮,我不希望弹出此屏幕。这可能吗?
提前致谢
when i am pressing the back button a pop screen is displayed which shows three button save, discard and cancel button i don't want this screen to be popped up. is this possible.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
后退按钮的默认行为是保存脏屏幕的更改。重写 onClose() 方法以覆盖默认行为。
您返回 true 是因为您管理了 ESC 按钮按下事件。查看 Screen 类文档。
您还可以更改 ESC 按钮的默认行为,重写 keyChar 方法,如下所示:
close() 应该类似于:
The default behaviour of the back button is to save changes for dirty screens. Rewrite the onClose() method to overwrite the default behaviour.
You return true because you managed the ESC button pressed event. Review the Screen class docs.
You can also change the default behaviour of the ESC button rewriting the keyChar method as follows:
close() should be somenthing like:
重写 onSavePrompt 方法。然后那个屏幕就不会出现。实际上,只有当屏幕上的内容发生更改时,才会出现该弹出屏幕。因此它会要求您采取适当的行动。
Override the onSavePrompt method. Then that screen will not come. Actually that popup screen will come only when something is changed on your screen. So it will ask you for the appropriate action.
跳过保存提示
Skip the saving prompt with it
像这样重写
onClose()
方法:您将不会收到烦人的警报消息。
Override
onClose()
method like this:you will not get that annoying alert message.