I have a form that must assign different handlers to a button's click event depending on a variable set elsewhere.
Each time the screen is loaded, I need to explicitly set the state of the button: its image, tooltiptext, and of course its click event handler. It's a huge complication (4*3*2 times - all the possible combinations) to have to keep track of and remove all existing handlers explicitly before assigning the correct handler for the current context.
QUESTION: How can I remove all handlers from an event without having to refer to them explicitly, so I can assign the correct one and know it will fire correctly?
Each time the screen is loaded, I need to explicitly set the state of the button: its image, tooltiptext, and of course its click event handler. It's a huge complication (4*3*2 times - all the possible combinations) to have to keep track of and remove all existing handlers explicitly before assigning the correct handler for the current context.
QUESTION: How can I remove all handlers from an event without having to refer to them explicitly, so I can assign the correct one and know it will fire correctly?