Dynamic Menus
All of the menu examples shown so far assume that you know the exact menu structure at the time you develop your application. Sometimes this menu is not known until after the application is built. A list of possible menu items may be defined in a configuration file or come from a database (the support for this is up to you to develop).
In any event, MenuItems allow you to define sub MenuItems while the application is running. This is accomplished through the use of events. When you move the cursor over a MenuItem, a Select event is dispatched to the MenuItem. This event can be intercepted to perform a number of different tasks such as constructing a submenu dynamically.
Using the nested menu example based on a deck of cards again, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access