void256 - 2011-07-15

@public

3366363: Nifty 1.3 PopupMenu does not work

The MenuControl is usually used inside a popup layer to create a PopupMenu. To be notified when a Menu Item has been clicked you'll subscribe for the MenuItemActivatedEvent for the MenuControl (inside of the popup layer). The MenuControl will automatically close the popup when a MenuItem has been clicked and after the popup layer is gone will publish the MenuItemActivatedEvent. The problem with this is that recently Nifty has been changed to automatically unsubscribe all event subscribers when a popup layer is being closed. This is in the general case expected behaviour, because when a popup layer is gone it doesn't make sense to subscribe for events for elements inside of that popup. In the MenuControl case however it broke the MenuItemActivatedEvent because the event subscriber was unsubscribed too :)

Now the MenuControl will not automatically close the popup anymore. This is now up to you when handling the MenuItemActivatedEvent. This has the additional benefit that in some cases you could decide to leave the popup menu open. Additionally you should subscribe for any events for elements inside the popup layer when the popup is being shown (this is independ of the MenuControl).