Creating a Custom Menu with Actions
-
I have been in the process of adding a custom menu with actions to the menubar in Sim4Life 4.2.1.3581.
The problem now is, that the custom Menu does not seem to properly add the action.
Not only does the action not appear in the menu, but the "Menu" property of the action is none-type.
Strangely enough, the "Actions"-property of the menu itself does list the test-action.
My code is this:import XCoreUI import XCore import testblock App = XCore.GetApp() ChildList = App.Frame.Children for i in range(len(ChildList)): test = ChildList.__getitem__(i) if test.Name == 'menu': break Menubar = ChildList.__getitem__(i) Menu = XCoreUI.Menu('test') subMenu = XCoreUI.Menu('subMenu') Menu.AddMenu(subMenu) Menubar.AddMenu(Menu) TestAktion = XCoreUI.Action('Test') TestAktion.Label = "Test" TestAktion.Name = "Name" TestAktion.Enabled = True Verbindung = TestAktion.OnTriggered.Connect(testblock.main) Menu.AddAction(TestAktion)
If anyone has any ideas, i would be gratefull.