MenuItem and add handler

Just to satisfy the curiosity of a few YES you can use addhandler with MenuItems

I made a post about it

Now would I recommend this style ? In general no.

But I have used it and in some cases its very handy since you may not be altering the menu item just changing the method that gets invoked.

For instance if you have a selection of numbers and want to invoke a “sort” method then you want something that will sort numerically. But if its a selection of non-numeric values then you want to sort in another fashion. Yet the menu item might just say “Sort”; or maybe sort ascending and one for sort descending.
So the handler might be swapped out ahead of time as the selection is made depending on what sort of selection you have. And you can do the proactively instead of after the fact in the menu handler. This might not be that significant in some cases; in others it can be.

Use with care and consideration of the implications of ANY use of addhandler