当用户单击上下文菜单中的禁用项目时,会调用哪个事件?
我有一个按钮,它显示上下文菜单。菜单中有几个项目(其中一些被禁用 - setEnabled(false))。
当用户单击禁用的项目时,会调用哪个事件?它不是 onContextItemSelected 也不是 onContextMenuClosed。但点击后菜单关闭。
感谢您的帮助。
I have button, which displays a Context menu. In the menu are few items (some of them are disabled - setEnabled(false)).
Which event is called when a user click on the disabled item? It's not onContextItemSelected nor onContextMenuClosed. But the menu is closed after the click.
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过与老师协商后,我已经解决了这个问题。您可以检查窗口的焦点,然后确定上下文菜单是否关闭。
所以你必须:
代码:
After consultation with my teacher, I've solved the problem. You can check the focus of your window, and then decide if the context menu was closed or not.
So you have to:
The code: