Free floating WPopupMenu when menu items are deleted in event handler
I am using a WPopupMenu structure with multiple levels (some items are WPopupMenus which also contains WPopupMenus, ..)
The WPopupMenu is attached to a WPushButton.
The event handler of the selected WMenuItem may trigger a series of events in which the selected WMenuItem or WPopupMenu (sub-menu) is deleted.
This causes free floating / detached WPopupMenus that remain visible even if the parent container or WPushButton it's attached to are deleted.
I assume this might be because the WPopupMenu object is deleted before it can properly be hidden and removed from the rendered web page.
Is there any workaround?