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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login