0

menu event - name?

I'm building up menus on start up based on the launch environment.

In code I need to know what the user clicked - how do I get the name of the menu item clicked?

Thank you!

3 条评论

  • 0
    Avatar
    Jon Morley

    Hi miniduck,

    Are you asking how to figure out to which event to bind your menu action?

    Have you tried choosing "Describe..." under the Help menu? It can show the key and event bindings as you press them. From the Help menu you can also print the list of current bindings.

    Does that help?

    Thanks,
    Jon

  • 0
    Avatar
    Johan

    Thanks

    I'm building up a menu in my init function when RV starts up based on the environment.
    I fixed it by having a class for each menu item with the name generated.

  • 0
    Avatar
    Jon Morley

    OK,

    I am still not totally sure how you solved your puzzle, but I am glad you have. I would also like to point out another useful method for controlling updating menus for packages. Please take a look at the commands.defineModeMenu method. Here are the docs from the Help -> "Mu Commands API Browser...":

    Path: commands.defineModeMenu

    defineModeMenu (void; 
                    string mode,
                    MenuItem[] menu,
                    bool strict = false)
    

    Description

    Define the menu structure associated with the mode. The menu is automatically merged into the main menu when the mode is active. When the mode is inactive the menu is not part of the main menu.

    You can use this method to dynamically update your packages menu as you see fit.

    Thanks,
    Jon

请先登录再写评论。