如何在 OSX 上的应用程序名称下创建子项目菜单?
如何在下面的屏幕截图中的Project1下和Quit上方添加TMenuItem?
我创建了一个 TMenuBar,并选中了 UseOSMenu 属性。 我添加的第一个 TMenuItem 是主栏中的第二个 TMenuItem...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过将 IItemsContainer 实现类的 TMenuBar 分配给 Application.ApplicationMenuItems 属性来完成此操作。
示例:
如果表单上有一个名为 MenuBar1 的菜单栏组件,那么您只需在表单构造函数(或 OnCreate)中调用以下代码即可。
Application.ApplicationMenuItems := Menubar1;
然后您可以使用第二个 TMenuBar 组件来定义其他菜单项。
我会向您指出有关 ApplicationMenuItems 属性的 wiki 主题,但它没有其他帮助...
http://docwiki.embarcadero.com/VCL/XE2/en/FMX.Forms.TApplication.ApplicationMenuItems
You can do this by assigning a TMenuBar of IItemsContainer implementing class to the Application.ApplicationMenuItems property.
Example:
If there was a menu bar component on the form called MenuBar1, then you would just call the following in your forms constructor (or OnCreate).
Application.ApplicationMenuItems := Menubar1;
You can then have a second TMenuBar component to define the other menu items.
I'd point you to the wiki topic on the ApplicationMenuItems property, but it has no additional help...
http://docwiki.embarcadero.com/VCL/XE2/en/FMX.Forms.TApplication.ApplicationMenuItems
我创建了一个单元来尝试管理我想要的东西......
有了它,我可以使用特定的 TMenuItem...并将其子项目移动到应用程序子菜单...(我仍然不知道如何从头开始添加一个...)
我也使用来自穆罕默德·阿里管理分隔符...
它按预期工作,这就是我在 OSX 上想要的...
但现在,我在 Windows 上遇到问题,因为无论我尝试什么,我仍然有为 Mac 添加的菜单在 Windows 下显示...;o(
I have created a unit to try to manage what I would like...
With it, I can use a specific TMenuItem... and move its subitems to the application submenu... (I still don't know how to add one from scratch...)
I also use the answer from Mehmed Ali to manage the separators...
It works as expected and it is what I want on OSX...
but now, I have an issue on Windows because whatever I try, I still have the menu I added for Mac displayed under Windows... ;o(
从 Delphi XE7 开始,
Application.ApplicationMenuItems
属性不再存在。您现在必须创建一个
TMainMenu
项才能获得预期结果,无需分配它。只需将TMainMenu
放到您的主窗体上并添加您的项目,它们就会出现在 OSX 应用程序菜单中。As of Delphi XE7, the
Application.ApplicationMenuItems
property no longer exists.You now have to create a
TMainMenu
item to get the expected result, no need to assign it. Just drop aTMainMenu
on to your main form and add your items, and they will appear in the OSX application menu.