SWT Text 小部件:如何将自己的 MenuItems 插入默认上下文菜单?
org.eclipse.swt.widgets.Text 类的默认上下文菜单非常丰富,包含用户依赖的功能...
但是,一旦我使用 Control.setMenu() 分配自己的上下文菜单,所有丰富性都会消失。有没有办法将我自己的 MenuItem 对象插入到这个系统创建的菜单中..我可以让我的蛋糕并吃掉它吗?
我们始终欢迎您提供线索。
M。
The default context menu for the org.eclipse.swt.widgets.Text class is quite a rich thing, packed with features that the user has come to depend on ...
However, as soon as I assign my own context menu with Control.setMenu() all that richness goes away. Is there a means of inserting my own MenuItem object into this system-created menu .. can I have my cake and eat it?
Your clues are always most welcome.
M.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法从 SWT 访问本机菜单。如果没有为该控件设置其他菜单,它就在那里。正如您所注意到的,一旦您为控件设置了自己的菜单,这个新菜单将完全取代本机菜单。
据我所知,这种行为对于所有平台都是通用的。
You cannot access the native menu from SWT. It is there, if there are no other menus set for the control. As you noticed, as soon as you set your own menu for the control, this new menu will completely replace the native menu.
As far as I can see, the behavior is common to all platforms.