MenuPopupButton.prepare

If set, this delegate is called before popping up the window. This gives you a chance to prepare your dynamic data structures for the element(s) selected.

For example, if your MenuPopupButton is attached to a GenericListViewItem, you can call GenericListViewItem.currentIndexLoaded in here and set it to a variable in the object you called createContextMenuFromAnnotatedCode to apply the operation to the right object.

(The api could probably be simpler...)

class MenuPopupButton
void delegate() prepare;

Meta