Dynamically menu selection

  1. 2 months ago
    Edited 2 months ago

    Hello,

    In the Menubar from a form I created a MenuItem named 'InstrumentMenu' and text 'Instrument'.
    Then when I open the form the submenu for that menuitem are created dynamically from a list and are all set to enable in the EnableMenuItems event from that form.
    When I now click on the menu item 'Instrument' I see the list that i have created dynamically.

    Question : how can I handle the selected submenu items from this menu ?
    How can I read the Text of the selected submenu item ?

    Regards
    Etienne

  2. Jason P

    Jan 9 Xojo Inc Texas

    This is where a custom subclass of menuitem would be useful. You add instances of your custom subclass to the menu you've created then you can implement the action event on that subclass and have full access to any of the menu item properties. See either of the examples: WindowMenu or OpenRecent.

  3. Thanks Jason.
    I need to look more into those examples. It took a while but i mastered it by examine the examples.
    It works fine now.
    Regards
    Etienne

or Sign Up to reply!